summaryrefslogtreecommitdiffstats
path: root/llvm/lib/IR/MDBuilder.cpp
diff options
context:
space:
mode:
authorDuncan P. N. Exon Smith <dexonsmith@apple.com>2015-01-19 21:30:18 +0000
committerDuncan P. N. Exon Smith <dexonsmith@apple.com>2015-01-19 21:30:18 +0000
commit7d82313bcd972be7a125dd9448a807eb100a520d (patch)
tree8963ef3187d3133f675a578956bb6ed8ea19b2bb /llvm/lib/IR/MDBuilder.cpp
parent2658554aeca02328bcd0ee9ca80d902e0a107563 (diff)
downloadbcm5719-llvm-7d82313bcd972be7a125dd9448a807eb100a520d.tar.gz
bcm5719-llvm-7d82313bcd972be7a125dd9448a807eb100a520d.zip
IR: Return unique_ptr from MDNode::getTemporary()
Change `MDTuple::getTemporary()` and `MDLocation::getTemporary()` to return (effectively) `std::unique_ptr<T, MDNode::deleteTemporary>`, and clean up call sites. (For now, `DIBuilder` call sites just call `release()` immediately.) There's an accompanying change in each of clang and polly to use the new API. llvm-svn: 226504
Diffstat (limited to 'llvm/lib/IR/MDBuilder.cpp')
-rw-r--r--llvm/lib/IR/MDBuilder.cpp6
1 files changed, 3 insertions, 3 deletions
diff --git a/llvm/lib/IR/MDBuilder.cpp b/llvm/lib/IR/MDBuilder.cpp
index c7fcf7a2c34..d6d03b48d0f 100644
--- a/llvm/lib/IR/MDBuilder.cpp
+++ b/llvm/lib/IR/MDBuilder.cpp
@@ -68,9 +68,9 @@ MDNode *MDBuilder::createRange(const APInt &Lo, const APInt &Hi) {
MDNode *MDBuilder::createAnonymousAARoot(StringRef Name, MDNode *Extra) {
// To ensure uniqueness the root node is self-referential.
- MDNode *Dummy = MDNode::getTemporary(Context, None);
+ auto Dummy = MDNode::getTemporary(Context, None);
- SmallVector<Metadata *, 3> Args(1, Dummy);
+ SmallVector<Metadata *, 3> Args(1, Dummy.get());
if (Extra)
Args.push_back(Extra);
if (!Name.empty())
@@ -82,7 +82,7 @@ MDNode *MDBuilder::createAnonymousAARoot(StringRef Name, MDNode *Extra) {
// !1 = metadata !{metadata !0} <- root
// Replace the dummy operand with the root node itself and delete the dummy.
Root->replaceOperandWith(0, Root);
- MDNode::deleteTemporary(Dummy);
+
// We now have
// !1 = metadata !{metadata !1} <- self-referential root
return Root;
OpenPOWER on IntegriCloud