From 44078b3260c2afd12775ff3c4bc755ce549ddf10 Mon Sep 17 00:00:00 2001 From: David Blaikie Date: Wed, 30 Apr 2014 22:41:33 +0000 Subject: DebugInfo: Omit DW_AT_artificial on DW_TAG_formal_parameters in DW_TAG_inlined_subroutines. They just don't need to be there - they're inherited from the abstract definition. In theory I would like them to be inherited from the declaration, but the DWARF standard doesn't quite say that... we can probably do it anyway but I'm less confident about that so I'll leave it for a separate commit. llvm-svn: 207717 --- llvm/lib/CodeGen/AsmPrinter/DwarfDebug.cpp | 33 +++++++++++++++++++----------- 1 file changed, 21 insertions(+), 12 deletions(-) (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 d3309c1e6e8..6960ec94551 100644 --- a/llvm/lib/CodeGen/AsmPrinter/DwarfDebug.cpp +++ b/llvm/lib/CodeGen/AsmPrinter/DwarfDebug.cpp @@ -509,6 +509,21 @@ DwarfDebug::constructInlinedScopeDIE(DwarfCompileUnit &TheCU, return ScopeDIE; } +static std::unique_ptr constructVariableDIE(DwarfCompileUnit &TheCU, + DbgVariable &DV, + const LexicalScope &Scope, + DIE *&ObjectPointer) { + AbstractOrInlined AOI = AOI_None; + if (Scope.isAbstractScope()) + AOI = AOI_Abstract; + else if (Scope.getInlinedAt()) + AOI = AOI_Inlined; + auto Var = TheCU.constructVariableDIE(DV, AOI); + if (DV.isObjectPointer()) + ObjectPointer = Var.get(); + return Var; +} + DIE *DwarfDebug::createScopeChildrenDIE( DwarfCompileUnit &TheCU, LexicalScope *Scope, SmallVectorImpl> &Children) { @@ -517,12 +532,9 @@ DIE *DwarfDebug::createScopeChildrenDIE( // Collect arguments for current function. if (LScopes.isCurrentFunctionScope(Scope)) { for (DbgVariable *ArgDV : CurrentFnArguments) - if (ArgDV) { + if (ArgDV) Children.push_back( - TheCU.constructVariableDIE(*ArgDV, Scope->isAbstractScope())); - if (ArgDV->isObjectPointer()) - ObjectPointer = Children.back().get(); - } + constructVariableDIE(TheCU, *ArgDV, *Scope, ObjectPointer)); // If this is a variadic function, add an unspecified parameter. DISubprogram SP(Scope->getScopeNode()); @@ -535,12 +547,9 @@ DIE *DwarfDebug::createScopeChildrenDIE( } // Collect lexical scope children first. - for (DbgVariable *DV : ScopeVariables.lookup(Scope)) { - Children.push_back( - TheCU.constructVariableDIE(*DV, Scope->isAbstractScope())); - if (DV->isObjectPointer()) - ObjectPointer = Children.back().get(); - } + for (DbgVariable *DV : ScopeVariables.lookup(Scope)) + Children.push_back(constructVariableDIE(TheCU, *DV, *Scope, ObjectPointer)); + for (LexicalScope *LS : Scope->getChildren()) if (std::unique_ptr Nested = constructScopeDIE(TheCU, LS)) Children.push_back(std::move(Nested)); @@ -897,7 +906,7 @@ void DwarfDebug::collectDeadVariables() { if (!DV.isVariable()) continue; DbgVariable NewVar(DV, nullptr, this); - SPDIE->addChild(SPCU->constructVariableDIE(NewVar, false)); + SPDIE->addChild(SPCU->constructVariableDIE(NewVar)); } } } -- cgit v1.2.3