Push DwarfDebug::attachRangesOrLowHighPC down into DwarfCompileUnit
authorDavid Blaikie <dblaikie@gmail.com>
Thu, 9 Oct 2014 00:21:42 +0000 (00:21 +0000)
committerDavid Blaikie <dblaikie@gmail.com>
Thu, 9 Oct 2014 00:21:42 +0000 (00:21 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@219372 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 8cc283f9a6ff3410b909492c30515bac70119a99..3e205132899463a82401f2e82c50d10696125294 100644 (file)
@@ -421,4 +421,14 @@ DwarfCompileUnit::addScopeRangeList(DIE &ScopeDIE,
   addRangeList(std::move(List));
 }
 
+void DwarfCompileUnit::attachRangesOrLowHighPC(
+    DIE &Die, const SmallVectorImpl<InsnRange> &Ranges) {
+  assert(!Ranges.empty());
+  if (Ranges.size() == 1)
+    attachLowHighPC(Die, DD->getLabelBeforeInsn(Ranges.front().first),
+                    DD->getLabelAfterInsn(Ranges.front().second));
+  else
+    addScopeRangeList(Die, Ranges);
+}
+
 } // end llvm namespace
index 2a0088e475f71e75aaa71777ce1bd2b7343a24b5..9623c079bfa3ef987ac3607178997719791d416e 100644 (file)
@@ -86,6 +86,9 @@ public:
   /// lexical scope.
   void addScopeRangeList(DIE &ScopeDIE,
                          const SmallVectorImpl<InsnRange> &Range);
+
+  void attachRangesOrLowHighPC(DIE &D,
+                               const SmallVectorImpl<InsnRange> &Ranges);
 };
 
 } // end llvm namespace
index 4d60259861c9ecc6d7414c28d826b141f684a98b..56d297363655f5b8f8f34a9787480b3e8bdd95b9 100644 (file)
@@ -330,16 +330,6 @@ bool DwarfDebug::isLexicalScopeDIENull(LexicalScope *Scope) {
   return !getLabelAfterInsn(Ranges.front().second);
 }
 
-void DwarfDebug::attachRangesOrLowHighPC(DwarfCompileUnit &TheCU, DIE &Die,
-                                    const SmallVectorImpl<InsnRange> &Ranges) {
-  assert(!Ranges.empty());
-  if (Ranges.size() == 1)
-    TheCU.attachLowHighPC(Die, getLabelBeforeInsn(Ranges.front().first),
-                          getLabelAfterInsn(Ranges.front().second));
-  else
-    TheCU.addScopeRangeList(Die, Ranges);
-}
-
 // Construct new DW_TAG_lexical_block for this scope and attach
 // DW_AT_low_pc/DW_AT_high_pc labels.
 std::unique_ptr<DIE>
@@ -352,7 +342,7 @@ DwarfDebug::constructLexicalScopeDIE(DwarfCompileUnit &TheCU,
   if (Scope->isAbstractScope())
     return ScopeDIE;
 
-  attachRangesOrLowHighPC(TheCU, *ScopeDIE, Scope->getRanges());
+  TheCU.attachRangesOrLowHighPC(*ScopeDIE, Scope->getRanges());
 
   return ScopeDIE;
 }
@@ -373,7 +363,7 @@ DwarfDebug::constructInlinedScopeDIE(DwarfCompileUnit &TheCU,
   auto ScopeDIE = make_unique<DIE>(dwarf::DW_TAG_inlined_subroutine);
   TheCU.addDIEEntry(*ScopeDIE, dwarf::DW_AT_abstract_origin, *OriginDIE);
 
-  attachRangesOrLowHighPC(TheCU, *ScopeDIE, Scope->getRanges());
+  TheCU.attachRangesOrLowHighPC(*ScopeDIE, Scope->getRanges());
 
   // Add the call site information to the DIE.
   DILocation DL(Scope->getInlinedAt());
index d047322b99513b8bde9f769938827f8fd5cb0261..d522455a4e56eb2c717707fe545e135b5aa8d24c 100644 (file)
@@ -518,9 +518,6 @@ class DwarfDebug : public AsmPrinterHandler {
     LabelsAfterInsn.insert(std::make_pair(MI, nullptr));
   }
 
-  void attachRangesOrLowHighPC(DwarfCompileUnit &Unit, DIE &D,
-                               const SmallVectorImpl<InsnRange> &Ranges);
-
 public:
   //===--------------------------------------------------------------------===//
   // Main entry points.