This is needed to support linking of module-level metadata as a
postpass after function importing, where we will be leaving temporary
metadata on imported instructions until the postpass metadata import.
Also added unittest. Split from D14838.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@254914
91177308-0d34-0410-b5e6-
96231b3b80d8
}
TempDILocation cloneImpl() const {
- return getTemporary(getContext(), getLine(), getColumn(), getScope(),
- getInlinedAt());
+ // Get the raw scope/inlinedAt since it is possible to invoke this on
+ // a DILocation containing temporary metadata.
+ return getTemporary(getContext(), getLine(), getColumn(), getRawScope(),
+ getRawInlinedAt());
}
// Disallow replacing operands.
EXPECT_FALSE(L->isResolved());
}
+TEST_F(DILocationTest, cloneTemporary) {
+ MDNode *N = MDNode::get(Context, None);
+ auto L = DILocation::getTemporary(Context, 2, 7, N);
+ EXPECT_TRUE(L->isTemporary());
+ auto L2 = L->clone();
+ EXPECT_TRUE(L2->isTemporary());
+}
+
typedef MetadataTest GenericDINodeTest;
TEST_F(GenericDINodeTest, get) {