[llvm] r214434 - DWOHolder takes ownership of the argument constructor, use std::unique_ptr.
Rafael Espindola
rafael.espindola at gmail.com
Thu Jul 31 13:26:43 PDT 2014
Author: rafael
Date: Thu Jul 31 15:26:42 2014
New Revision: 214434
URL: http://llvm.org/viewvc/llvm-project?rev=214434&view=rev
Log:
DWOHolder takes ownership of the argument constructor, use std::unique_ptr.
Thanks to David Blaikie for noticing it.
Modified:
llvm/trunk/lib/DebugInfo/DWARFUnit.cpp
llvm/trunk/lib/DebugInfo/DWARFUnit.h
Modified: llvm/trunk/lib/DebugInfo/DWARFUnit.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/DebugInfo/DWARFUnit.cpp?rev=214434&r1=214433&r2=214434&view=diff
==============================================================================
--- llvm/trunk/lib/DebugInfo/DWARFUnit.cpp (original)
+++ llvm/trunk/lib/DebugInfo/DWARFUnit.cpp Thu Jul 31 15:26:42 2014
@@ -235,9 +235,10 @@ size_t DWARFUnit::extractDIEsIfNeeded(bo
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()) {
Modified: llvm/trunk/lib/DebugInfo/DWARFUnit.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/DebugInfo/DWARFUnit.h?rev=214434&r1=214433&r2=214434&view=diff
==============================================================================
--- llvm/trunk/lib/DebugInfo/DWARFUnit.h (original)
+++ llvm/trunk/lib/DebugInfo/DWARFUnit.h Thu Jul 31 15:26:42 2014
@@ -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;
More information about the llvm-commits
mailing list