CodeGen: Move the call to DwarfDebug::beginModule() out of the constructor.

This gives AsmPrinter a chance to initialize its DD field before
we call beginModule(), which is about to start using it.

Differential Revision: http://reviews.llvm.org/D20413

llvm-svn: 270258
This commit is contained in:
Peter Collingbourne 2016-05-20 19:35:35 +00:00
parent 96c9ae6a20
commit 5973bc8a82
2 changed files with 2 additions and 5 deletions

View File

@ -253,6 +253,7 @@ bool AsmPrinter::doInitialization(Module &M) {
}
if (!EmitCodeView || MMI->getModule()->getDwarfVersion()) {
DD = new DwarfDebug(this, &M);
DD->beginModule();
Handlers.push_back(HandlerInfo(DD, DbgTimerName, DWARFGroupName));
}
}

View File

@ -269,11 +269,6 @@ DwarfDebug::DwarfDebug(AsmPrinter *A, Module *M)
UseDWARF2Bitfields = (DwarfVersion < 4) || tuneForGDB();
Asm->OutStreamer->getContext().setDwarfVersion(DwarfVersion);
{
NamedRegionTimer T(DbgTimerName, DWARFGroupName, TimePassesIsEnabled);
beginModule();
}
}
// Define out of line so we don't have to include DwarfUnit.h in DwarfDebug.h.
@ -465,6 +460,7 @@ void DwarfDebug::constructAndAddImportedEntityDIE(DwarfCompileUnit &TheCU,
// global DIEs and emit initial debug info sections. This is invoked by
// the target AsmPrinter.
void DwarfDebug::beginModule() {
NamedRegionTimer T(DbgTimerName, DWARFGroupName, TimePassesIsEnabled);
if (DisableDebugInfoPrinting)
return;