Merge 'ConstructFunctionDbgScope' and 'ConstructAbstractDbgScope'.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@72197 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/lib/CodeGen/AsmPrinter/DwarfDebug.cpp b/lib/CodeGen/AsmPrinter/DwarfDebug.cpp
index ec4602d..bdbb988 100644
--- a/lib/CodeGen/AsmPrinter/DwarfDebug.cpp
+++ b/lib/CodeGen/AsmPrinter/DwarfDebug.cpp
@@ -1092,7 +1092,8 @@
 
 /// ConstructFunctionDbgScope - Construct the scope for the subprogram.
 ///
-void DwarfDebug::ConstructFunctionDbgScope(DbgScope *RootScope) {
+void DwarfDebug::ConstructFunctionDbgScope(DbgScope *RootScope,
+                                           bool AbstractScope) {
   // Exit if there is no root scope.
   if (!RootScope) return;
   DIDescriptor Desc = RootScope->getDesc();
@@ -1111,43 +1112,19 @@
   DIE *SPDie = Unit->getDieMapSlotFor(SPD.getGV());
   assert(SPDie && "Missing subprogram descriptor");
 
-  // Add the function bounds.
-  AddLabel(SPDie, dwarf::DW_AT_low_pc, dwarf::DW_FORM_addr,
-           DWLabel("func_begin", SubprogramCount));
-  AddLabel(SPDie, dwarf::DW_AT_high_pc, dwarf::DW_FORM_addr,
-           DWLabel("func_end", SubprogramCount));
-  MachineLocation Location(RI->getFrameRegister(*MF));
-  AddAddress(SPDie, dwarf::DW_AT_frame_base, Location);
+  if (!AbstractScope) {
+    // Add the function bounds.
+    AddLabel(SPDie, dwarf::DW_AT_low_pc, dwarf::DW_FORM_addr,
+             DWLabel("func_begin", SubprogramCount));
+    AddLabel(SPDie, dwarf::DW_AT_high_pc, dwarf::DW_FORM_addr,
+             DWLabel("func_end", SubprogramCount));
+    MachineLocation Location(RI->getFrameRegister(*MF));
+    AddAddress(SPDie, dwarf::DW_AT_frame_base, Location);
+  }
 
   ConstructDbgScope(RootScope, 0, 0, SPDie, Unit);
 }
 
-/// ConstructFunctionDbgScope - Construct the scope for the abstract debug
-/// scope.
-///
-void DwarfDebug::ConstructAbstractDbgScope(DbgScope *AbsScope) {
-  // Exit if there is no root scope.
-  if (!AbsScope) return;
-
-  DIDescriptor Desc = AbsScope->getDesc();
-  if (Desc.isNull())
-    return;
-
-  // Get the subprogram debug information entry.
-  DISubprogram SPD(Desc.getGV());
-
-  // Get the compile unit context.
-  CompileUnit *Unit = MainCU;
-  if (!Unit)
-    Unit = &FindCompileUnit(SPD.getCompileUnit());
-
-  // Get the subprogram die.
-  DIE *SPDie = Unit->getDieMapSlotFor(SPD.getGV());
-  assert(SPDie && "Missing subprogram descriptor");
-
-  ConstructDbgScope(AbsScope, 0, 0, SPDie, Unit);
-}
-
 /// ConstructDefaultDbgScope - Construct a default scope for the subprogram.
 ///
 void DwarfDebug::ConstructDefaultDbgScope(MachineFunction *MF) {
@@ -1587,7 +1564,7 @@
   for (SmallVector<DbgScope *, 32>::iterator
          I = AbstractInstanceRootList.begin(),
          E = AbstractInstanceRootList.end(); I != E; ++I)
-    ConstructAbstractDbgScope(*I);
+    ConstructFunctionDbgScope(*I);
 
   // Construct scopes for subprogram.
   if (FunctionDbgScope)
diff --git a/lib/CodeGen/AsmPrinter/DwarfDebug.h b/lib/CodeGen/AsmPrinter/DwarfDebug.h
index d81ebbf..9824566 100644
--- a/lib/CodeGen/AsmPrinter/DwarfDebug.h
+++ b/lib/CodeGen/AsmPrinter/DwarfDebug.h
@@ -355,12 +355,8 @@
 
   /// ConstructFunctionDbgScope - Construct the scope for the subprogram.
   ///
-  void ConstructFunctionDbgScope(DbgScope *RootScope);
-
-  /// ConstructFunctionDbgScope - Construct the scope for the abstract debug
-  /// scope.
-  ///
-  void ConstructAbstractDbgScope(DbgScope *AbsScope);
+  void ConstructFunctionDbgScope(DbgScope *RootScope,
+                                 bool AbstractScope = false);
 
   /// ConstructDefaultDbgScope - Construct a default scope for the subprogram.
   ///