diff options
author | Duncan P. N. Exon Smith <dexonsmith@apple.com> | 2015-01-19 21:30:18 +0000 |
---|---|---|
committer | Duncan P. N. Exon Smith <dexonsmith@apple.com> | 2015-01-19 21:30:18 +0000 |
commit | f9eaea701dd2771fbd72145ed8eaaaeb62779b08 (patch) | |
tree | a62d58a3705c38c06d23fb7cbd115fda9ef3554c /lib/IR/MDBuilder.cpp | |
parent | a23cc6a1ea64d1eeaf61ca45881b61036f414913 (diff) |
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.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@226504 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/IR/MDBuilder.cpp')
-rw-r--r-- | lib/IR/MDBuilder.cpp | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/lib/IR/MDBuilder.cpp b/lib/IR/MDBuilder.cpp index c7fcf7a2c34..d6d03b48d0f 100644 --- a/lib/IR/MDBuilder.cpp +++ b/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; |