mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-06-19 18:24:00 +00:00
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
This commit is contained in:
@ -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;
|
||||
|
Reference in New Issue
Block a user