[llvm] r195536 - DwarfDebug: Move ownership of CompileUnits into DwarfUnits
David Blaikie
dblaikie at gmail.com
Fri Nov 22 17:17:34 PST 2013
Author: dblaikie
Date: Fri Nov 22 19:17:34 2013
New Revision: 195536
URL: http://llvm.org/viewvc/llvm-project?rev=195536&view=rev
Log:
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.
Modified:
llvm/trunk/lib/CodeGen/AsmPrinter/DwarfDebug.cpp
llvm/trunk/lib/CodeGen/AsmPrinter/DwarfDebug.h
Modified: llvm/trunk/lib/CodeGen/AsmPrinter/DwarfDebug.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/AsmPrinter/DwarfDebug.cpp?rev=195536&r1=195535&r2=195536&view=diff
==============================================================================
--- llvm/trunk/lib/CodeGen/AsmPrinter/DwarfDebug.cpp (original)
+++ llvm/trunk/lib/CodeGen/AsmPrinter/DwarfDebug.cpp Fri Nov 22 19:17:34 2013
@@ -240,6 +240,12 @@ static MCSymbol *emitSectionSym(AsmPrint
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::constructSkelet
}
SkeletonHolder.addUnit(NewCU);
- SkeletonCUs.push_back(NewCU);
return NewCU;
}
Modified: llvm/trunk/lib/CodeGen/AsmPrinter/DwarfDebug.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/AsmPrinter/DwarfDebug.h?rev=195536&r1=195535&r2=195536&view=diff
==============================================================================
--- llvm/trunk/lib/CodeGen/AsmPrinter/DwarfDebug.h (original)
+++ llvm/trunk/lib/CodeGen/AsmPrinter/DwarfDebug.h Fri Nov 22 19:17:34 2013
@@ -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;
More information about the llvm-commits
mailing list