[llvm] r219437 - Sink DwarfDebug::createAndAddScopeChildren down into DwarfCompileUnit.

David Blaikie dblaikie at gmail.com
Thu Oct 9 13:26:15 PDT 2014


Author: dblaikie
Date: Thu Oct  9 15:26:15 2014
New Revision: 219437

URL: http://llvm.org/viewvc/llvm-project?rev=219437&view=rev
Log:
Sink DwarfDebug::createAndAddScopeChildren down into DwarfCompileUnit.

Modified:
    llvm/trunk/lib/CodeGen/AsmPrinter/DwarfCompileUnit.cpp
    llvm/trunk/lib/CodeGen/AsmPrinter/DwarfCompileUnit.h
    llvm/trunk/lib/CodeGen/AsmPrinter/DwarfDebug.cpp
    llvm/trunk/lib/CodeGen/AsmPrinter/DwarfDebug.h

Modified: llvm/trunk/lib/CodeGen/AsmPrinter/DwarfCompileUnit.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/AsmPrinter/DwarfCompileUnit.cpp?rev=219437&r1=219436&r2=219437&view=diff
==============================================================================
--- llvm/trunk/lib/CodeGen/AsmPrinter/DwarfCompileUnit.cpp (original)
+++ llvm/trunk/lib/CodeGen/AsmPrinter/DwarfCompileUnit.cpp Thu Oct  9 15:26:15 2014
@@ -599,8 +599,7 @@ void DwarfCompileUnit::constructSubprogr
   // Collect lexical scope children first.
   // ObjectPointer might be a local (non-argument) local variable if it's a
   // block's synthetic this pointer.
-  if (DIE *BlockObjPtr =
-          DD->createAndAddScopeChildren(*this, Scope, ScopeDIE)) {
+  if (DIE *BlockObjPtr = createAndAddScopeChildren(Scope, ScopeDIE)) {
     assert(!ObjectPointer && "multiple object pointers can't be described");
     ObjectPointer = BlockObjPtr;
   }
@@ -609,4 +608,17 @@ void DwarfCompileUnit::constructSubprogr
     addDIEEntry(ScopeDIE, dwarf::DW_AT_object_pointer, *ObjectPointer);
 }
 
+DIE *DwarfCompileUnit::createAndAddScopeChildren(LexicalScope *Scope,
+                                                 DIE &ScopeDIE) {
+  // We create children when the scope DIE is not null.
+  SmallVector<std::unique_ptr<DIE>, 8> Children;
+  DIE *ObjectPointer = createScopeChildrenDIE(Scope, Children);
+
+  // Add children
+  for (auto &I : Children)
+    ScopeDIE.addChild(std::move(I));
+
+  return ObjectPointer;
+}
+
 } // end llvm namespace

Modified: llvm/trunk/lib/CodeGen/AsmPrinter/DwarfCompileUnit.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/AsmPrinter/DwarfCompileUnit.h?rev=219437&r1=219436&r2=219437&view=diff
==============================================================================
--- llvm/trunk/lib/CodeGen/AsmPrinter/DwarfCompileUnit.h (original)
+++ llvm/trunk/lib/CodeGen/AsmPrinter/DwarfCompileUnit.h Thu Oct  9 15:26:15 2014
@@ -118,6 +118,8 @@ public:
 
   /// \brief Construct a DIE for this subprogram scope.
   void constructSubprogramScopeDIE(LexicalScope *Scope);
+
+  DIE *createAndAddScopeChildren(LexicalScope *Scope, DIE &ScopeDIE);
 };
 
 } // end llvm namespace

Modified: llvm/trunk/lib/CodeGen/AsmPrinter/DwarfDebug.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/AsmPrinter/DwarfDebug.cpp?rev=219437&r1=219436&r2=219437&view=diff
==============================================================================
--- llvm/trunk/lib/CodeGen/AsmPrinter/DwarfDebug.cpp (original)
+++ llvm/trunk/lib/CodeGen/AsmPrinter/DwarfDebug.cpp Thu Oct  9 15:26:15 2014
@@ -330,19 +330,6 @@ bool DwarfDebug::isLexicalScopeDIENull(L
   return !getLabelAfterInsn(Ranges.front().second);
 }
 
-DIE *DwarfDebug::createAndAddScopeChildren(DwarfCompileUnit &TheCU,
-                                           LexicalScope *Scope, DIE &ScopeDIE) {
-  // We create children when the scope DIE is not null.
-  SmallVector<std::unique_ptr<DIE>, 8> Children;
-  DIE *ObjectPointer = TheCU.createScopeChildrenDIE(Scope, Children);
-
-  // Add children
-  for (auto &I : Children)
-    ScopeDIE.addChild(std::move(I));
-
-  return ObjectPointer;
-}
-
 void DwarfDebug::constructAbstractSubprogramScopeDIE(DwarfCompileUnit &TheCU,
                                                      LexicalScope *Scope) {
   assert(Scope && Scope->getScopeNode());
@@ -380,7 +367,7 @@ void DwarfDebug::constructAbstractSubpro
 
   if (TheCU.getCUNode().getEmissionKind() != DIBuilder::LineTablesOnly)
     SPCU.addUInt(*AbsDef, dwarf::DW_AT_inline, None, dwarf::DW_INL_inlined);
-  if (DIE *ObjectPointer = createAndAddScopeChildren(SPCU, Scope, *AbsDef))
+  if (DIE *ObjectPointer = SPCU.createAndAddScopeChildren(Scope, *AbsDef))
     SPCU.addDIEEntry(*AbsDef, dwarf::DW_AT_object_pointer, *ObjectPointer);
 }
 

Modified: llvm/trunk/lib/CodeGen/AsmPrinter/DwarfDebug.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/AsmPrinter/DwarfDebug.h?rev=219437&r1=219436&r2=219437&view=diff
==============================================================================
--- llvm/trunk/lib/CodeGen/AsmPrinter/DwarfDebug.h (original)
+++ llvm/trunk/lib/CodeGen/AsmPrinter/DwarfDebug.h Thu Oct  9 15:26:15 2014
@@ -682,9 +682,6 @@ public:
   SmallVector<DbgVariable *, 8> &getCurrentFnArguments() {
     return CurrentFnArguments;
   }
-
-  DIE *createAndAddScopeChildren(DwarfCompileUnit &TheCU, LexicalScope *Scope,
-                                 DIE &ScopeDIE);
 };
 } // End of namespace llvm
 





More information about the llvm-commits mailing list