DwarfDebug: Move ownership of CompileUnits into DwarfUnits

This avoids the need for an extra list of SkeletonCUs and associated
cleanup while staging things to be cleaner for further type unit
improvements.

Also hopefully fixes a memory leak introduced in r195166.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@195536 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
David Blaikie 2013-11-23 01:17:34 +00:00
parent bc8569d0c0
commit a3507d4883
2 changed files with 8 additions and 13 deletions

View File

@ -240,6 +240,12 @@ static MCSymbol *emitSectionSym(AsmPrinter *Asm, const MCSection *Section,
return TmpSym;
}
DwarfUnits::~DwarfUnits() {
for (SmallVectorImpl<CompileUnit *>::iterator I = CUs.begin(), E = CUs.end();
I != E; ++I)
delete *I;
}
MCSymbol *DwarfUnits::getStringPoolSym() {
return Asm->GetTempSymbol(StringPref);
}
@ -1201,15 +1207,6 @@ void DwarfDebug::endModule() {
// clean up.
SPMap.clear();
for (DenseMap<const MDNode *, CompileUnit *>::iterator I = CUMap.begin(),
E = CUMap.end();
I != E; ++I)
delete I->second;
for (SmallVectorImpl<CompileUnit *>::iterator I = SkeletonCUs.begin(),
E = SkeletonCUs.end();
I != E; ++I)
delete *I;
// Reset these for the next Module if we have one.
FirstCU = NULL;
@ -3021,7 +3018,6 @@ CompileUnit *DwarfDebug::constructSkeletonCU(const CompileUnit *CU) {
}
SkeletonHolder.addUnit(NewCU);
SkeletonCUs.push_back(NewCU);
return NewCU;
}

View File

@ -256,6 +256,8 @@ public:
NextStringPoolNumber(0), StringPref(Pref), AddressPool(),
NextAddrPoolNumber(0) {}
~DwarfUnits();
/// \brief Compute the size and offset of a DIE given an incoming Offset.
unsigned computeSizeAndOffset(DIE *Die, unsigned Offset);
@ -468,9 +470,6 @@ class DwarfDebug {
// original object file, rather than things that are meant
// to be in the .dwo sections.
// The CUs left in the original object file for separated debug info.
SmallVector<CompileUnit *, 1> SkeletonCUs;
// Used to uniquely define abbreviations for the skeleton emission.
FoldingSet<DIEAbbrev> SkeletonAbbrevSet;