From 81a95a816bf3a020a30597c0cd86d7ebcc58f9c0 Mon Sep 17 00:00:00 2001 From: David Blaikie Date: Thu, 9 Oct 2014 17:56:39 +0000 Subject: [PATCH] Sink DwarfDebug.cpp::constructVariableDIE into DwarfCompileUnit. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@219419 91177308-0d34-0410-b5e6-96231b3b80d8 --- lib/CodeGen/AsmPrinter/DwarfCompileUnit.cpp | 8 ++++++++ lib/CodeGen/AsmPrinter/DwarfCompileUnit.h | 4 ++++ lib/CodeGen/AsmPrinter/DwarfDebug.cpp | 14 ++------------ 3 files changed, 14 insertions(+), 12 deletions(-) diff --git a/lib/CodeGen/AsmPrinter/DwarfCompileUnit.cpp b/lib/CodeGen/AsmPrinter/DwarfCompileUnit.cpp index 973997ecd4c..26cca502216 100644 --- a/lib/CodeGen/AsmPrinter/DwarfCompileUnit.cpp +++ b/lib/CodeGen/AsmPrinter/DwarfCompileUnit.cpp @@ -542,4 +542,12 @@ DwarfCompileUnit::constructVariableDIEImpl(const DbgVariable &DV, return VariableDie; } +std::unique_ptr DwarfCompileUnit::constructVariableDIE( + DbgVariable &DV, const LexicalScope &Scope, DIE *&ObjectPointer) { + auto Var = constructVariableDIE(DV, Scope.isAbstractScope()); + if (DV.isObjectPointer()) + ObjectPointer = Var.get(); + return Var; +} + } // end llvm namespace diff --git a/lib/CodeGen/AsmPrinter/DwarfCompileUnit.h b/lib/CodeGen/AsmPrinter/DwarfCompileUnit.h index 06fab23d5c6..9ad503cb882 100644 --- a/lib/CodeGen/AsmPrinter/DwarfCompileUnit.h +++ b/lib/CodeGen/AsmPrinter/DwarfCompileUnit.h @@ -106,6 +106,10 @@ public: /// constructVariableDIE - Construct a DIE for the given DbgVariable. std::unique_ptr constructVariableDIE(DbgVariable &DV, bool Abstract = false); + + std::unique_ptr constructVariableDIE(DbgVariable &DV, + const LexicalScope &Scope, + DIE *&ObjectPointer); }; } // end llvm namespace diff --git a/lib/CodeGen/AsmPrinter/DwarfDebug.cpp b/lib/CodeGen/AsmPrinter/DwarfDebug.cpp index a45e5ba0684..75206d2d85d 100644 --- a/lib/CodeGen/AsmPrinter/DwarfDebug.cpp +++ b/lib/CodeGen/AsmPrinter/DwarfDebug.cpp @@ -330,16 +330,6 @@ bool DwarfDebug::isLexicalScopeDIENull(LexicalScope *Scope) { return !getLabelAfterInsn(Ranges.front().second); } -static std::unique_ptr constructVariableDIE(DwarfCompileUnit &TheCU, - DbgVariable &DV, - const LexicalScope &Scope, - DIE *&ObjectPointer) { - auto Var = TheCU.constructVariableDIE(DV, Scope.isAbstractScope()); - if (DV.isObjectPointer()) - ObjectPointer = Var.get(); - return Var; -} - DIE *DwarfDebug::createScopeChildrenDIE( DwarfCompileUnit &TheCU, LexicalScope *Scope, SmallVectorImpl> &Children, @@ -347,7 +337,7 @@ DIE *DwarfDebug::createScopeChildrenDIE( DIE *ObjectPointer = nullptr; for (DbgVariable *DV : ScopeVariables.lookup(Scope)) - Children.push_back(constructVariableDIE(TheCU, *DV, *Scope, ObjectPointer)); + Children.push_back(TheCU.constructVariableDIE(*DV, *Scope, ObjectPointer)); unsigned ChildCountWithoutScopes = Children.size(); @@ -433,7 +423,7 @@ void DwarfDebug::constructSubprogramScopeDIE(DwarfCompileUnit &TheCU, for (DbgVariable *ArgDV : CurrentFnArguments) if (ArgDV) ScopeDIE.addChild( - constructVariableDIE(TheCU, *ArgDV, *Scope, ObjectPointer)); + TheCU.constructVariableDIE(*ArgDV, *Scope, ObjectPointer)); // If this is a variadic function, add an unspecified parameter. DITypeArray FnArgs = Sub.getType().getTypeArray(); -- 2.34.1