DebugInfo: Use TempMDNode in DIDescriptor::replaceAllUsesWith()
authorDuncan P. N. Exon Smith <dexonsmith@apple.com>
Sat, 28 Feb 2015 23:48:02 +0000 (23:48 +0000)
committerDuncan P. N. Exon Smith <dexonsmith@apple.com>
Sat, 28 Feb 2015 23:48:02 +0000 (23:48 +0000)
commitb3381acab26b228bd170452ce26d346f24f404a3
treed538350a47153258069d871d6092f9c041324f0a
parentbe657e70b1b15a0ae98f58d7cccec97805fdb0c4
DebugInfo: Use TempMDNode in DIDescriptor::replaceAllUsesWith()

Start using `TempMDNode` in `DIDescriptor::replaceAllUsesWith()`
(effectively `std::unique_ptr<MDNode, MDNode::deleteTemporary>`).

Besides making ownership more explicit, this prepares for when
`DIDescriptor` refers to nodes that are *not* `MDTuple`.  The old logic
for "replacing" a node with itself used `MDNode::get()` to return a new
(uniqued) `MDTuple`, while the new logic just defers to
`MDNode::replaceWithUniqued()` (which also typically saves an allocation
and RAUW traffic by mutating the temporary in place).

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@230879 91177308-0d34-0410-b5e6-96231b3b80d8
lib/IR/DebugInfo.cpp