IR: Add MDLocation::getTemporary()

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@226502 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Duncan P. N. Exon Smith 2015-01-19 20:37:44 +00:00
parent 8ec0aee3b4
commit a7852bfa47
2 changed files with 13 additions and 0 deletions

View File

@ -945,6 +945,11 @@ public:
Metadata *InlinedAt = nullptr) {
return getImpl(Context, Line, Column, Scope, InlinedAt, Distinct);
}
static MDLocation *getTemporary(LLVMContext &Context, unsigned Line,
unsigned Column, Metadata *Scope,
Metadata *InlinedAt = nullptr) {
return getImpl(Context, Line, Column, Scope, InlinedAt, Temporary);
}
unsigned getLine() const { return MDNodeSubclassData; }
unsigned getColumn() const { return SubclassData16; }

View File

@ -483,6 +483,14 @@ TEST_F(MDLocationTest, getDistinct) {
EXPECT_EQ(L1, MDLocation::get(Context, 2, 7, N));
}
TEST_F(MDLocationTest, getTemporary) {
MDNode *N = MDNode::get(Context, None);
MDLocation *L = MDLocation::getTemporary(Context, 2, 7, N);
EXPECT_TRUE(L->isTemporary());
EXPECT_FALSE(L->isResolved());
MDNode::deleteTemporary(L);
}
typedef MetadataTest MetadataAsValueTest;
TEST_F(MetadataAsValueTest, MDNode) {