summaryrefslogtreecommitdiffstats
path: root/llvm
diff options
context:
space:
mode:
authorDuncan P. N. Exon Smith <dexonsmith@apple.com>2015-01-19 20:37:44 +0000
committerDuncan P. N. Exon Smith <dexonsmith@apple.com>2015-01-19 20:37:44 +0000
commit799e56a9ae40adb682d7cd2b9a69e0e3a2802977 (patch)
tree0de4c06ec2fecc5973bc4f3ed8e26cc98df41d5e /llvm
parent946fdcc50cbda9cc30bb78f6c71aa49f3c3ae7ae (diff)
downloadbcm5719-llvm-799e56a9ae40adb682d7cd2b9a69e0e3a2802977.tar.gz
bcm5719-llvm-799e56a9ae40adb682d7cd2b9a69e0e3a2802977.zip
IR: Add MDLocation::getTemporary()
llvm-svn: 226502
Diffstat (limited to 'llvm')
-rw-r--r--llvm/include/llvm/IR/Metadata.h5
-rw-r--r--llvm/unittests/IR/MetadataTest.cpp8
2 files changed, 13 insertions, 0 deletions
diff --git a/llvm/include/llvm/IR/Metadata.h b/llvm/include/llvm/IR/Metadata.h
index 6f02ee1e704..2b37412660d 100644
--- a/llvm/include/llvm/IR/Metadata.h
+++ b/llvm/include/llvm/IR/Metadata.h
@@ -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; }
diff --git a/llvm/unittests/IR/MetadataTest.cpp b/llvm/unittests/IR/MetadataTest.cpp
index 9515f0de4ff..498728e3cac 100644
--- a/llvm/unittests/IR/MetadataTest.cpp
+++ b/llvm/unittests/IR/MetadataTest.cpp
@@ -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) {
OpenPOWER on IntegriCloud