summaryrefslogtreecommitdiffstats
path: root/llvm/lib/CodeGen/AsmPrinter/DwarfCompileUnit.h
diff options
context:
space:
mode:
Diffstat (limited to 'llvm/lib/CodeGen/AsmPrinter/DwarfCompileUnit.h')
-rw-r--r--llvm/lib/CodeGen/AsmPrinter/DwarfCompileUnit.h9
1 files changed, 8 insertions, 1 deletions
diff --git a/llvm/lib/CodeGen/AsmPrinter/DwarfCompileUnit.h b/llvm/lib/CodeGen/AsmPrinter/DwarfCompileUnit.h
index 332e058f303..90f74a3686e 100644
--- a/llvm/lib/CodeGen/AsmPrinter/DwarfCompileUnit.h
+++ b/llvm/lib/CodeGen/AsmPrinter/DwarfCompileUnit.h
@@ -118,7 +118,14 @@ public:
unsigned getOrCreateSourceID(StringRef FileName, StringRef DirName) override;
void addImportedEntity(const DIImportedEntity* IE) {
- ImportedEntities[IE->getScope()].push_back(IE);
+ DIScope *Scope = IE->getScope();
+ assert(Scope && "Invalid Scope encoding!");
+ if (!isa<DILocalScope>(Scope))
+ // No need to add imported enities that are not local declaration.
+ return;
+
+ auto *LocalScope = cast<DILocalScope>(Scope)->getNonLexicalBlockFileScope();
+ ImportedEntities[LocalScope].push_back(IE);
}
/// addRange - Add an address range to the list of ranges for this unit.
OpenPOWER on IntegriCloud