mirror of
https://github.com/RPCS3/llvm.git
synced 2024-12-13 23:18:58 +00:00
DWOHolder takes ownership of the argument constructor, use std::unique_ptr.
Thanks to David Blaikie for noticing it. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@214434 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
81becb73ab
commit
fc272c3b9e
@ -235,9 +235,10 @@ size_t DWARFUnit::extractDIEsIfNeeded(bool CUDieOnly) {
|
|||||||
return DieArray.size();
|
return DieArray.size();
|
||||||
}
|
}
|
||||||
|
|
||||||
DWARFUnit::DWOHolder::DWOHolder(object::ObjectFile *DWOFile)
|
DWARFUnit::DWOHolder::DWOHolder(std::unique_ptr<object::ObjectFile> DWOFile)
|
||||||
: DWOFile(DWOFile),
|
: DWOFile(std::move(DWOFile)),
|
||||||
DWOContext(cast<DWARFContext>(DIContext::getDWARFContext(*DWOFile))),
|
DWOContext(
|
||||||
|
cast<DWARFContext>(DIContext::getDWARFContext(*this->DWOFile))),
|
||||||
DWOU(nullptr) {
|
DWOU(nullptr) {
|
||||||
if (DWOContext->getNumDWOCompileUnits() > 0)
|
if (DWOContext->getNumDWOCompileUnits() > 0)
|
||||||
DWOU = DWOContext->getDWOCompileUnitAtIndex(0);
|
DWOU = DWOContext->getDWOCompileUnitAtIndex(0);
|
||||||
@ -265,7 +266,7 @@ bool DWARFUnit::parseDWO() {
|
|||||||
if (!DWOFile)
|
if (!DWOFile)
|
||||||
return false;
|
return false;
|
||||||
// Reset DWOHolder.
|
// Reset DWOHolder.
|
||||||
DWO.reset(new DWOHolder(DWOFile.get().get()));
|
DWO = llvm::make_unique<DWOHolder>(std::move(*DWOFile));
|
||||||
DWARFUnit *DWOCU = DWO->getUnit();
|
DWARFUnit *DWOCU = DWO->getUnit();
|
||||||
// Verify that compile unit in .dwo file is valid.
|
// Verify that compile unit in .dwo file is valid.
|
||||||
if (!DWOCU || DWOCU->getDWOId() != getDWOId()) {
|
if (!DWOCU || DWOCU->getDWOId() != getDWOId()) {
|
||||||
|
@ -52,7 +52,7 @@ class DWARFUnit {
|
|||||||
std::unique_ptr<DWARFContext> DWOContext;
|
std::unique_ptr<DWARFContext> DWOContext;
|
||||||
DWARFUnit *DWOU;
|
DWARFUnit *DWOU;
|
||||||
public:
|
public:
|
||||||
DWOHolder(object::ObjectFile *DWOFile);
|
DWOHolder(std::unique_ptr<object::ObjectFile> DWOFile);
|
||||||
DWARFUnit *getUnit() const { return DWOU; }
|
DWARFUnit *getUnit() const { return DWOU; }
|
||||||
};
|
};
|
||||||
std::unique_ptr<DWOHolder> DWO;
|
std::unique_ptr<DWOHolder> DWO;
|
||||||
|
Loading…
Reference in New Issue
Block a user