Sink the per-CU part of DwarfDebug::finishSubprogramDefinitions into DwarfCompileUnit.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@219477 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
David Blaikie 2014-10-10 06:39:29 +00:00
parent 43ed8aefd3
commit 0c3d37644a
3 changed files with 21 additions and 15 deletions

View File

@ -650,4 +650,22 @@ DwarfCompileUnit::constructAbstractSubprogramScopeDIE(LexicalScope *Scope) {
return AbsDef;
}
void DwarfCompileUnit::finishSubprogramDefinition(DISubprogram SP) {
DIE *D = getDIE(SP);
if (DIE *AbsSPDIE = DD->getAbstractSPDies().lookup(SP)) {
if (D)
// If this subprogram has an abstract definition, reference that
addDIEEntry(*D, dwarf::DW_AT_abstract_origin, *AbsSPDIE);
} else {
if (!D && getCUNode().getEmissionKind() != DIBuilder::LineTablesOnly)
// Lazily construct the subprogram if we didn't see either concrete or
// inlined versions during codegen. (except in -gmlt ^ where we want
// to omit these entirely)
D = getOrCreateSubprogramDIE(SP);
if (D)
// And attach the attributes
applySubprogramAttributesToDefinition(SP, *D);
}
}
} // end llvm namespace

View File

@ -122,6 +122,8 @@ public:
DIE *createAndAddScopeChildren(LexicalScope *Scope, DIE &ScopeDIE);
DIE &constructAbstractSubprogramScopeDIE(LexicalScope *Scope);
void finishSubprogramDefinition(DISubprogram SP);
};
} // end llvm namespace

View File

@ -530,21 +530,7 @@ void DwarfDebug::finishSubprogramDefinitions() {
// folding, etc), in which case ignore it here.
if (SPMap[SP] != SPCU)
continue;
DIE *D = SPCU->getDIE(SP);
if (DIE *AbsSPDIE = AbstractSPDies.lookup(SP)) {
if (D)
// If this subprogram has an abstract definition, reference that
SPCU->addDIEEntry(*D, dwarf::DW_AT_abstract_origin, *AbsSPDIE);
} else {
if (!D && TheCU.getEmissionKind() != DIBuilder::LineTablesOnly)
// Lazily construct the subprogram if we didn't see either concrete or
// inlined versions during codegen. (except in -gmlt ^ where we want
// to omit these entirely)
D = SPCU->getOrCreateSubprogramDIE(SP);
if (D)
// And attach the attributes
SPCU->applySubprogramAttributesToDefinition(SP, *D);
}
SPCU->finishSubprogramDefinition(SP);
}
}
}