From: Rafael Espindola Date: Thu, 31 Jul 2014 20:26:42 +0000 (+0000) Subject: DWOHolder takes ownership of the argument constructor, use std::unique_ptr. X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=cf8dd265c5646df8c63626f69bd9c7fa6084d219;p=platform%2Fupstream%2Fllvm.git DWOHolder takes ownership of the argument constructor, use std::unique_ptr. Thanks to David Blaikie for noticing it. llvm-svn: 214434 --- diff --git a/llvm/lib/DebugInfo/DWARFUnit.cpp b/llvm/lib/DebugInfo/DWARFUnit.cpp index 197d347..d528216 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(DIContext::getDWARFContext(*DWOFile))), +DWARFUnit::DWOHolder::DWOHolder(std::unique_ptr DWOFile) + : DWOFile(std::move(DWOFile)), + DWOContext( + cast(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(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 471da36..b4073f9 100644 --- a/llvm/lib/DebugInfo/DWARFUnit.h +++ b/llvm/lib/DebugInfo/DWARFUnit.h @@ -52,7 +52,7 @@ class DWARFUnit { std::unique_ptr DWOContext; DWARFUnit *DWOU; public: - DWOHolder(object::ObjectFile *DWOFile); + DWOHolder(std::unique_ptr DWOFile); DWARFUnit *getUnit() const { return DWOU; } }; std::unique_ptr DWO;