From 169ffe41affece998de11f33b2ce0b8d191754b7 Mon Sep 17 00:00:00 2001 From: David Blaikie Date: Fri, 23 May 2014 20:25:15 +0000 Subject: DebugInfo: Put concrete definitions referencing abstract definitions in the same scope as the abstract definition. This seems like a simple cleanup/improved consistency, but also helps lay the foundation to fix the bug mentioned in the test case: concrete definitions preceeding any inlined usage aren't properly split into concrete + abstract (because they're not known to need it until it's too late). Once we start deferring this choice until later, we won't have the choice to put concrete definitions for inlined subroutines in a different scope from concrete definitions for non-inlined subroutines (since we won't know at time-of-construction which one it'll be). This change brings those two cases into alignment ahead of that future chaneg/fix. llvm-svn: 209547 --- llvm/lib/CodeGen/AsmPrinter/DwarfDebug.cpp | 4 +++- 1 file changed, 3 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 37136b2a202..5c802f7a2ce 100644 --- a/llvm/lib/CodeGen/AsmPrinter/DwarfDebug.cpp +++ b/llvm/lib/CodeGen/AsmPrinter/DwarfDebug.cpp @@ -324,7 +324,9 @@ DIE &DwarfDebug::updateSubprogramScopeDIE(DwarfCompileUnit &SPCU, if (DIE *AbsSPDIE = AbstractSPDies.lookup(SP)) { assert(SPDie == AbsSPDIE); // Pick up abstract subprogram DIE. - SPDie = &SPCU.createAndAddDIE(dwarf::DW_TAG_subprogram, SPCU.getUnitDie()); + SPDie = &SPCU.createAndAddDIE( + dwarf::DW_TAG_subprogram, + *SPCU.getOrCreateContextDIE(resolve(SP.getContext()))); SPCU.addDIEEntry(*SPDie, dwarf::DW_AT_abstract_origin, *AbsSPDIE); } -- cgit v1.2.3