]> granicus.if.org Git - llvm/commitdiff
Sink DwarfDebug::createAndAddScopeChildren down into DwarfCompileUnit.
authorDavid Blaikie <dblaikie@gmail.com>
Thu, 9 Oct 2014 20:26:15 +0000 (20:26 +0000)
committerDavid Blaikie <dblaikie@gmail.com>
Thu, 9 Oct 2014 20:26:15 +0000 (20:26 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@219437 91177308-0d34-0410-b5e6-96231b3b80d8

lib/CodeGen/AsmPrinter/DwarfCompileUnit.cpp
lib/CodeGen/AsmPrinter/DwarfCompileUnit.h
lib/CodeGen/AsmPrinter/DwarfDebug.cpp
lib/CodeGen/AsmPrinter/DwarfDebug.h

index 13bd12ee2049d91c8bf80fa6b7a3123d3cffa177..ec5c2ba399ec3b5a0497cef996b766d87c0f5e4c 100644 (file)
@@ -599,8 +599,7 @@ void DwarfCompileUnit::constructSubprogramScopeDIE(LexicalScope *Scope) {
   // 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::constructSubprogramScopeDIE(LexicalScope *Scope) {
     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
index fb6a867cc7d918bbdeb33a11a44eadde4447ba35..9b97a51d371ed50b057005b817cb9e1a2855b0e9 100644 (file)
@@ -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
index 49afdf275e3cb1f9a7aaf03f4880d80bb20be5f8..86fe1a9e7040e370d0f8ce39597a8a094cbc7dff 100644 (file)
@@ -330,19 +330,6 @@ bool DwarfDebug::isLexicalScopeDIENull(LexicalScope *Scope) {
   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::constructAbstractSubprogramScopeDIE(DwarfCompileUnit &TheCU,
 
   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);
 }
 
index 7d72602792f749538c53ebe776c80ae6a0952c57..7ee0bc7fe6a810061e51d9391afdd7fe4c1d6aa8 100644 (file)
@@ -682,9 +682,6 @@ public:
   SmallVector<DbgVariable *, 8> &getCurrentFnArguments() {
     return CurrentFnArguments;
   }
-
-  DIE *createAndAddScopeChildren(DwarfCompileUnit &TheCU, LexicalScope *Scope,
-                                 DIE &ScopeDIE);
 };
 } // End of namespace llvm