[llvm] r226502 - IR: Add MDLocation::getTemporary()
Duncan P. N. Exon Smith
dexonsmith at apple.com
Mon Jan 19 12:37:44 PST 2015
Author: dexonsmith
Date: Mon Jan 19 14:37:44 2015
New Revision: 226502
URL: http://llvm.org/viewvc/llvm-project?rev=226502&view=rev
Log:
IR: Add MDLocation::getTemporary()
Modified:
llvm/trunk/include/llvm/IR/Metadata.h
llvm/trunk/unittests/IR/MetadataTest.cpp
Modified: llvm/trunk/include/llvm/IR/Metadata.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/IR/Metadata.h?rev=226502&r1=226501&r2=226502&view=diff
==============================================================================
--- llvm/trunk/include/llvm/IR/Metadata.h (original)
+++ llvm/trunk/include/llvm/IR/Metadata.h Mon Jan 19 14:37:44 2015
@@ -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; }
Modified: llvm/trunk/unittests/IR/MetadataTest.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/unittests/IR/MetadataTest.cpp?rev=226502&r1=226501&r2=226502&view=diff
==============================================================================
--- llvm/trunk/unittests/IR/MetadataTest.cpp (original)
+++ llvm/trunk/unittests/IR/MetadataTest.cpp Mon Jan 19 14:37:44 2015
@@ -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) {
More information about the llvm-commits
mailing list