summaryrefslogtreecommitdiffstats
path: root/llvm/lib/CodeGen/AsmPrinter/DwarfDebug.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'llvm/lib/CodeGen/AsmPrinter/DwarfDebug.cpp')
-rw-r--r--llvm/lib/CodeGen/AsmPrinter/DwarfDebug.cpp32
1 files changed, 5 insertions, 27 deletions
diff --git a/llvm/lib/CodeGen/AsmPrinter/DwarfDebug.cpp b/llvm/lib/CodeGen/AsmPrinter/DwarfDebug.cpp
index 589f88d1de6..d4d94cabe83 100644
--- a/llvm/lib/CodeGen/AsmPrinter/DwarfDebug.cpp
+++ b/llvm/lib/CodeGen/AsmPrinter/DwarfDebug.cpp
@@ -455,16 +455,6 @@ void DwarfDebug::constructAndAddImportedEntityDIE(DwarfCompileUnit &TheCU,
D->addChild(TheCU.constructImportedEntityDIE(N));
}
-bool DwarfDebug::collectLocalScopedNode(DIScope *S, const DINode *N,
- DwarfCompileUnit &CU) {
- if (auto LS = dyn_cast_or_null<DILocalScope>(S)) {
- getLocalScopes(LS->getSubprogram()).insert(LS);
- CU.addLocalDeclNode(N, LS);
- return true;
- }
- return false;
-}
-
// Emit all Dwarf sections that should come prior to the content. Create
// global DIEs and emit initial debug info sections. This is invoked by
// the target AsmPrinter.
@@ -484,9 +474,10 @@ void DwarfDebug::beginModule() {
for (MDNode *N : CU_Nodes->operands()) {
auto *CUNode = cast<DICompileUnit>(N);
DwarfCompileUnit &CU = constructDwarfCompileUnit(CUNode);
+ for (auto *IE : CUNode->getImportedEntities())
+ CU.addImportedEntity(IE);
for (auto *GV : CUNode->getGlobalVariables())
- if (!collectLocalScopedNode(GV->getScope(), GV, CU))
- CU.getOrCreateGlobalVariableDIE(GV);
+ CU.getOrCreateGlobalVariableDIE(GV);
for (auto *SP : CUNode->getSubprograms())
SPMap.insert(std::make_pair(SP, &CU));
for (auto *Ty : CUNode->getEnumTypes()) {
@@ -498,17 +489,14 @@ void DwarfDebug::beginModule() {
// The retained types array by design contains pointers to
// MDNodes rather than DIRefs. Unique them here.
DIType *RT = cast<DIType>(resolve(Ty->getRef()));
- if (RT->isExternalTypeRef())
+ if (!RT->isExternalTypeRef())
// There is no point in force-emitting a forward declaration.
- continue;
- if (!collectLocalScopedNode(resolve(Ty->getScope()), RT, CU))
CU.getOrCreateTypeDIE(RT);
}
// Emit imported_modules last so that the relevant context is already
// available.
for (auto *IE : CUNode->getImportedEntities())
- if (!collectLocalScopedNode(IE->getScope(), IE, CU))
- constructAndAddImportedEntityDIE(CU, IE);
+ constructAndAddImportedEntityDIE(CU, IE);
}
// Tell MMI that we have debug info.
@@ -541,11 +529,6 @@ void DwarfDebug::finishSubprogramDefinitions() {
});
}
-void DwarfDebug::finishLocalScopeDefinitions() {
- for (const auto &I : CUMap)
- I.second->finishLocalScopeDefinitions();
-}
-
// Collect info for variables that were optimized out.
void DwarfDebug::collectDeadVariables() {
const Module *M = MMI->getModule();
@@ -571,8 +554,6 @@ void DwarfDebug::finalizeModuleInfo() {
finishSubprogramDefinitions();
- finishLocalScopeDefinitions();
-
finishVariableDefinitions();
// Collect info for variables that were optimized out.
@@ -1183,9 +1164,6 @@ void DwarfDebug::endFunction(const MachineFunction *MF) {
assert(LScopes.getAbstractScopesList().size() == NumAbstractScopes
&& "ensureAbstractVariableIsCreated inserted abstract scopes");
}
- // Assure abstract local scope created for each one contains local DIEs.
- for (const DILocalScope *LS : getLocalScopes(SP))
- LScopes.getOrCreateAbstractScope(LS);
constructAbstractSubprogramScopeDIE(AScope);
}
OpenPOWER on IntegriCloud