DebugInfo: Just store the DIE by value in the DwarfUnit

Since all 4 ctor calls in DwarfDebug just pass in a trivially
constructed DIE with the right tag type, sink the tag selection down
into the Dwarf*Unit ctors (removing the argument entirely from callers
in DwarfDebug) and initialize the DIE member in DwarfUnit.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@207448 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
David Blaikie
2014-04-28 21:14:27 +00:00
parent c5211fe18a
commit 9feea1a5a1
3 changed files with 37 additions and 40 deletions

View File

@ -653,9 +653,7 @@ DwarfCompileUnit &DwarfDebug::constructDwarfCompileUnit(DICompileUnit DIUnit) {
CompilationDir = DIUnit.getDirectory();
auto OwnedUnit = make_unique<DwarfCompileUnit>(
InfoHolder.getUnits().size(),
make_unique<DIE>(dwarf::DW_TAG_compile_unit), DIUnit, Asm, this,
&InfoHolder);
InfoHolder.getUnits().size(), DIUnit, Asm, this, &InfoHolder);
DwarfCompileUnit &NewCU = *OwnedUnit;
DIE &Die = NewCU.getUnitDie();
InfoHolder.addUnit(std::move(OwnedUnit));
@ -2426,8 +2424,7 @@ void DwarfDebug::initSkeletonUnit(const DwarfUnit &U, DIE &Die,
DwarfCompileUnit &DwarfDebug::constructSkeletonCU(const DwarfCompileUnit &CU) {
auto OwnedUnit = make_unique<DwarfCompileUnit>(
CU.getUniqueID(), make_unique<DIE>(dwarf::DW_TAG_compile_unit),
CU.getCUNode(), Asm, this, &SkeletonHolder);
CU.getUniqueID(), CU.getCUNode(), Asm, this, &SkeletonHolder);
DwarfCompileUnit &NewCU = *OwnedUnit;
NewCU.initSection(Asm->getObjFileLowering().getDwarfInfoSection(),
DwarfInfoSectionSym);
@ -2445,9 +2442,8 @@ DwarfTypeUnit &DwarfDebug::constructSkeletonTU(DwarfTypeUnit &TU) {
DwarfCompileUnit &CU = static_cast<DwarfCompileUnit &>(
*SkeletonHolder.getUnits()[TU.getCU().getUniqueID()]);
auto OwnedUnit = make_unique<DwarfTypeUnit>(
TU.getUniqueID(), make_unique<DIE>(dwarf::DW_TAG_type_unit), CU, Asm,
this, &SkeletonHolder);
auto OwnedUnit = make_unique<DwarfTypeUnit>(TU.getUniqueID(), CU, Asm, this,
&SkeletonHolder);
DwarfTypeUnit &NewTU = *OwnedUnit;
NewTU.setTypeSignature(TU.getTypeSignature());
NewTU.setType(nullptr);
@ -2530,9 +2526,9 @@ void DwarfDebug::addDwarfTypeUnitType(DwarfCompileUnit &CU,
bool TopLevelType = TypeUnitsUnderConstruction.empty();
AddrPool.resetUsedFlag();
auto OwnedUnit = make_unique<DwarfTypeUnit>(
InfoHolder.getUnits().size(), make_unique<DIE>(dwarf::DW_TAG_type_unit),
CU, Asm, this, &InfoHolder, getDwoLineTable(CU));
auto OwnedUnit =
make_unique<DwarfTypeUnit>(InfoHolder.getUnits().size(), CU, Asm, this,
&InfoHolder, getDwoLineTable(CU));
DwarfTypeUnit &NewTU = *OwnedUnit;
DIE &UnitDie = NewTU.getUnitDie();
TU = &NewTU;