mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-06-15 05:24:01 +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:
@ -541,9 +541,8 @@ void BitcodeReaderMDValueList::AssignValue(Metadata *MD, unsigned Idx) {
|
||||
}
|
||||
|
||||
// If there was a forward reference to this value, replace it.
|
||||
MDTuple *PrevMD = cast<MDTuple>(OldMD.get());
|
||||
TempMDTuple PrevMD(cast<MDTuple>(OldMD.get()));
|
||||
PrevMD->replaceAllUsesWith(MD);
|
||||
MDNode::deleteTemporary(PrevMD);
|
||||
--NumFwdRefs;
|
||||
}
|
||||
|
||||
@ -557,7 +556,7 @@ Metadata *BitcodeReaderMDValueList::getValueFwdRef(unsigned Idx) {
|
||||
// Create and return a placeholder, which will later be RAUW'd.
|
||||
AnyFwdRefs = true;
|
||||
++NumFwdRefs;
|
||||
Metadata *MD = MDNode::getTemporary(Context, None);
|
||||
Metadata *MD = MDNode::getTemporary(Context, None).release();
|
||||
MDValuePtrs[Idx].reset(MD);
|
||||
return MD;
|
||||
}
|
||||
|
Reference in New Issue
Block a user