From e847f132f76b25f523b16a32f828cac372a7f963 Mon Sep 17 00:00:00 2001 From: David Blaikie Date: Fri, 13 Jun 2014 22:35:44 +0000 Subject: DebugInfo: Reference abstract definitions from variables in concrete definitions that preceed their first inline definition. Rather than relying on abstract variables looked up at the time the concrete variable is created, look them up at the end of the module to ensure they're referenced even if they're created after the concrete definition. This completes/matches the work done in r209677 to handle this for the subprograms themselves. llvm-svn: 210946 --- llvm/lib/CodeGen/AsmPrinter/DwarfDebug.cpp | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) (limited to 'llvm/lib/CodeGen/AsmPrinter/DwarfDebug.cpp') diff --git a/llvm/lib/CodeGen/AsmPrinter/DwarfDebug.cpp b/llvm/lib/CodeGen/AsmPrinter/DwarfDebug.cpp index 1eb88b9178d..77bb77d4a5f 100644 --- a/llvm/lib/CodeGen/AsmPrinter/DwarfDebug.cpp +++ b/llvm/lib/CodeGen/AsmPrinter/DwarfDebug.cpp @@ -791,7 +791,7 @@ void DwarfDebug::finishVariableDefinitions() { // DIE::getUnit isn't simple - it walks parent pointers, etc. DwarfCompileUnit *Unit = lookupUnit(VariableDie->getUnit()); assert(Unit); - DbgVariable *AbsVar = Var->getAbstractVariable(); + DbgVariable *AbsVar = getExistingAbstractVariable(Var->getVariable()); if (AbsVar && AbsVar->getDIE()) { Unit->addDIEEntry(*VariableDie, dwarf::DW_AT_abstract_origin, *AbsVar->getDIE()); @@ -1081,6 +1081,11 @@ DbgVariable *DwarfDebug::getExistingAbstractVariable(const DIVariable &DV, return nullptr; } +DbgVariable *DwarfDebug::getExistingAbstractVariable(const DIVariable &DV) { + DIVariable Cleansed; + return getExistingAbstractVariable(DV, Cleansed); +} + DbgVariable *DwarfDebug::createAbstractVariable(DIVariable &Var, LexicalScope *Scope) { auto AbsDbgVariable = make_unique(Var, nullptr, this); -- cgit v1.2.3