Simplify a few uses of DwarfDebug::SPMap

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@219510 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
David Blaikie 2014-10-10 16:59:52 +00:00
parent 17dbd06faf
commit 68084538cb
2 changed files with 4 additions and 22 deletions

View File

@ -345,9 +345,7 @@ void DwarfDebug::constructAbstractSubprogramScopeDIE(LexicalScope *Scope) {
// Find the subprogram's DwarfCompileUnit in the SPMap in case the subprogram
// was inlined from another compile unit.
DwarfCompileUnit &SPCU = *SPMap[SP];
AbsDef = &SPCU.constructAbstractSubprogramScopeDIE(Scope);
AbsDef = &SPMap[SP]->constructAbstractSubprogramScopeDIE(Scope);
}
void DwarfDebug::addGnuPubAttributes(DwarfUnit &U, DIE &D) const {
@ -515,24 +513,8 @@ void DwarfDebug::finishVariableDefinitions() {
}
void DwarfDebug::finishSubprogramDefinitions() {
const Module *M = MMI->getModule();
NamedMDNode *CU_Nodes = M->getNamedMetadata("llvm.dbg.cu");
for (MDNode *N : CU_Nodes->operands()) {
DICompileUnit TheCU(N);
// Construct subprogram DIE and add variables DIEs.
DwarfCompileUnit *SPCU =
static_cast<DwarfCompileUnit *>(CUMap.lookup(TheCU));
DIArray Subprograms = TheCU.getSubprograms();
for (unsigned i = 0, e = Subprograms.getNumElements(); i != e; ++i) {
DISubprogram SP(Subprograms.getElement(i));
// Perhaps the subprogram is in another CU (such as due to comdat
// folding, etc), in which case ignore it here.
if (SPMap[SP] != SPCU)
continue;
SPCU->finishSubprogramDefinition(SP);
}
}
for (const auto &P : SPMap)
P.second->finishSubprogramDefinition(DISubprogram(P.first));
}

View File

@ -174,7 +174,7 @@ class DwarfDebug : public AsmPrinterHandler {
MapVector<const MDNode *, DwarfCompileUnit *> CUMap;
// Maps subprogram MDNode with its corresponding DwarfCompileUnit.
DenseMap<const MDNode *, DwarfCompileUnit *> SPMap;
MapVector<const MDNode *, DwarfCompileUnit *> SPMap;
// Maps a CU DIE with its corresponding DwarfCompileUnit.
DenseMap<const DIE *, DwarfCompileUnit *> CUDieMap;