aboutsummaryrefslogtreecommitdiff
path: root/llvm/lib/Bitcode/Reader/BitcodeReader.cpp
diff options
context:
space:
mode:
authorDuncan P. N. Exon Smith <dexonsmith@apple.com>2015-01-19 21:30:18 +0000
committerDuncan P. N. Exon Smith <dexonsmith@apple.com>2015-01-19 21:30:18 +0000
commit7d82313bcd972be7a125dd9448a807eb100a520d (patch)
tree8963ef3187d3133f675a578956bb6ed8ea19b2bb /llvm/lib/Bitcode/Reader/BitcodeReader.cpp
parent2658554aeca02328bcd0ee9ca80d902e0a107563 (diff)
downloadllvm-7d82313bcd972be7a125dd9448a807eb100a520d.zip
llvm-7d82313bcd972be7a125dd9448a807eb100a520d.tar.gz
llvm-7d82313bcd972be7a125dd9448a807eb100a520d.tar.bz2
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. llvm-svn: 226504
Diffstat (limited to 'llvm/lib/Bitcode/Reader/BitcodeReader.cpp')
-rw-r--r--llvm/lib/Bitcode/Reader/BitcodeReader.cpp5
1 files changed, 2 insertions, 3 deletions
diff --git a/llvm/lib/Bitcode/Reader/BitcodeReader.cpp b/llvm/lib/Bitcode/Reader/BitcodeReader.cpp
index a9adaf4..c158d35 100644
--- a/llvm/lib/Bitcode/Reader/BitcodeReader.cpp
+++ b/llvm/lib/Bitcode/Reader/BitcodeReader.cpp
@@ -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;
}