mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-06-13 04:38:24 +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:
@ -319,13 +319,12 @@ static void CloneAliasScopeMetadata(CallSite CS, ValueToValueMapTy &VMap) {
|
||||
|
||||
// Now we have a complete set of all metadata in the chains used to specify
|
||||
// the noalias scopes and the lists of those scopes.
|
||||
SmallVector<MDTuple *, 16> DummyNodes;
|
||||
SmallVector<TempMDTuple, 16> DummyNodes;
|
||||
DenseMap<const MDNode *, TrackingMDNodeRef> MDMap;
|
||||
for (SetVector<const MDNode *>::iterator I = MD.begin(), IE = MD.end();
|
||||
I != IE; ++I) {
|
||||
MDTuple *Dummy = MDTuple::getTemporary(CalledFunc->getContext(), None);
|
||||
DummyNodes.push_back(Dummy);
|
||||
MDMap[*I].reset(Dummy);
|
||||
DummyNodes.push_back(MDTuple::getTemporary(CalledFunc->getContext(), None));
|
||||
MDMap[*I].reset(DummyNodes.back().get());
|
||||
}
|
||||
|
||||
// Create new metadata nodes to replace the dummy nodes, replacing old
|
||||
@ -389,10 +388,6 @@ static void CloneAliasScopeMetadata(CallSite CS, ValueToValueMapTy &VMap) {
|
||||
NI->setMetadata(LLVMContext::MD_noalias, M);
|
||||
}
|
||||
}
|
||||
|
||||
// Now that everything has been replaced, delete the dummy nodes.
|
||||
for (unsigned i = 0, ie = DummyNodes.size(); i != ie; ++i)
|
||||
MDNode::deleteTemporary(DummyNodes[i]);
|
||||
}
|
||||
|
||||
/// AddAliasScopeMetadata - If the inlined function has noalias arguments, then
|
||||
|
Reference in New Issue
Block a user