summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRafael Espindola <rafael.espindola@gmail.com>2014-07-31 20:26:42 +0000
committerRafael Espindola <rafael.espindola@gmail.com>2014-07-31 20:26:42 +0000
commitcf8dd265c5646df8c63626f69bd9c7fa6084d219 (patch)
tree56de6891432b1423e7da750c6e28519c9113c629
parenta04bb5b1e11ad0da8fb3afc73d920f3b467efd61 (diff)
downloadbcm5719-llvm-cf8dd265c5646df8c63626f69bd9c7fa6084d219.tar.gz
bcm5719-llvm-cf8dd265c5646df8c63626f69bd9c7fa6084d219.zip
DWOHolder takes ownership of the argument constructor, use std::unique_ptr.
Thanks to David Blaikie for noticing it. llvm-svn: 214434
-rw-r--r--llvm/lib/DebugInfo/DWARFUnit.cpp9
-rw-r--r--llvm/lib/DebugInfo/DWARFUnit.h2
2 files changed, 6 insertions, 5 deletions
diff --git a/llvm/lib/DebugInfo/DWARFUnit.cpp b/llvm/lib/DebugInfo/DWARFUnit.cpp
index 197d347090d..d52821602d2 100644
--- a/llvm/lib/DebugInfo/DWARFUnit.cpp
+++ b/llvm/lib/DebugInfo/DWARFUnit.cpp
@@ -235,9 +235,10 @@ size_t DWARFUnit::extractDIEsIfNeeded(bool CUDieOnly) {
return DieArray.size();
}
-DWARFUnit::DWOHolder::DWOHolder(object::ObjectFile *DWOFile)
- : DWOFile(DWOFile),
- DWOContext(cast<DWARFContext>(DIContext::getDWARFContext(*DWOFile))),
+DWARFUnit::DWOHolder::DWOHolder(std::unique_ptr<object::ObjectFile> DWOFile)
+ : DWOFile(std::move(DWOFile)),
+ DWOContext(
+ cast<DWARFContext>(DIContext::getDWARFContext(*this->DWOFile))),
DWOU(nullptr) {
if (DWOContext->getNumDWOCompileUnits() > 0)
DWOU = DWOContext->getDWOCompileUnitAtIndex(0);
@@ -265,7 +266,7 @@ bool DWARFUnit::parseDWO() {
if (!DWOFile)
return false;
// Reset DWOHolder.
- DWO.reset(new DWOHolder(DWOFile.get().get()));
+ DWO = llvm::make_unique<DWOHolder>(std::move(*DWOFile));
DWARFUnit *DWOCU = DWO->getUnit();
// Verify that compile unit in .dwo file is valid.
if (!DWOCU || DWOCU->getDWOId() != getDWOId()) {
diff --git a/llvm/lib/DebugInfo/DWARFUnit.h b/llvm/lib/DebugInfo/DWARFUnit.h
index 471da36af1c..b4073f99d3f 100644
--- a/llvm/lib/DebugInfo/DWARFUnit.h
+++ b/llvm/lib/DebugInfo/DWARFUnit.h
@@ -52,7 +52,7 @@ class DWARFUnit {
std::unique_ptr<DWARFContext> DWOContext;
DWARFUnit *DWOU;
public:
- DWOHolder(object::ObjectFile *DWOFile);
+ DWOHolder(std::unique_ptr<object::ObjectFile> DWOFile);
DWARFUnit *getUnit() const { return DWOU; }
};
std::unique_ptr<DWOHolder> DWO;
OpenPOWER on IntegriCloud