From: David Blaikie Date: Fri, 23 May 2014 04:23:06 +0000 (+0000) Subject: DebugInfo: Fix cross-CU references for scopes (and variables within those scopes... X-Git-Url: http://plrg.eecs.uci.edu/git/?a=commitdiff_plain;h=e4dfe5d46fb263d0a826529041e31d15e5e8be96;p=oota-llvm.git DebugInfo: Fix cross-CU references for scopes (and variables within those scopes) in abstract definitions of cross-CU inlined functions Found by Adrian Prantl during post-commit review of r209335. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@209498 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/lib/CodeGen/AsmPrinter/DwarfDebug.cpp b/lib/CodeGen/AsmPrinter/DwarfDebug.cpp index 049e9e28c11..44aa529cfa4 100644 --- a/lib/CodeGen/AsmPrinter/DwarfDebug.cpp +++ b/lib/CodeGen/AsmPrinter/DwarfDebug.cpp @@ -528,11 +528,12 @@ void DwarfDebug::constructAbstractSubprogramScopeDIE(DwarfCompileUnit &TheCU, // Find the subprogram's DwarfCompileUnit in the SPMap in case the subprogram // was inlined from another compile unit. - DIE *ScopeDIE = SPMap[Sub]->getDIE(Sub); + DwarfCompileUnit &SPCU = *SPMap[Sub]; + DIE *ScopeDIE = SPCU.getDIE(Sub); assert(ScopeDIE); AbstractSPDies.insert(std::make_pair(Sub, ScopeDIE)); - TheCU.addUInt(*ScopeDIE, dwarf::DW_AT_inline, None, dwarf::DW_INL_inlined); - createAndAddScopeChildren(TheCU, Scope, *ScopeDIE); + SPCU.addUInt(*ScopeDIE, dwarf::DW_AT_inline, None, dwarf::DW_INL_inlined); + createAndAddScopeChildren(SPCU, Scope, *ScopeDIE); } DIE &DwarfDebug::constructSubprogramScopeDIE(DwarfCompileUnit &TheCU, diff --git a/test/DebugInfo/cross-cu-inlining.ll b/test/DebugInfo/cross-cu-inlining.ll index ae684ad507c..44a1a585069 100644 --- a/test/DebugInfo/cross-cu-inlining.ll +++ b/test/DebugInfo/cross-cu-inlining.ll @@ -27,6 +27,9 @@ ; CHECK-NEXT: DW_AT_abstract_origin {{.*}}[[ABS_FUNC:........]]) ; CHECK: DW_TAG_formal_parameter ; CHECK-NEXT: DW_AT_abstract_origin {{.*}}[[ABS_VAR:........]]) +; CHECK: 0x[[INT:.*]]: DW_TAG_base_type +; CHECK-NOT: DW_TAG +; CHECK: DW_AT_name {{.*}} "int" ; Check the abstract definition is in the 'b.cpp' CU and doesn't contain any ; concrete information (address range or variable location) @@ -35,6 +38,9 @@ ; CHECK: 0x[[ABS_FUNC]]: DW_TAG_subprogram ; CHECK-NOT: DW_AT_low_pc ; CHECK: 0x[[ABS_VAR]]: DW_TAG_formal_parameter +; CHECK-NOT: DW_TAG +; CHECK-NOT: DW_AT_location +; CHECK: DW_AT_type [DW_FORM_ref_addr] (0x00000000[[INT]]) ; CHECK-NOT: DW_AT_location ; Check the concrete out of line definition references the abstract and