OSDN Git Service

Sink the per-CU part of DwarfDebug::finishSubprogramDefinitions into DwarfCompileUnit.
authorDavid Blaikie <dblaikie@gmail.com>
Fri, 10 Oct 2014 06:39:29 +0000 (06:39 +0000)
committerDavid Blaikie <dblaikie@gmail.com>
Fri, 10 Oct 2014 06:39:29 +0000 (06:39 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@219477 91177308-0d34-0410-b5e6-96231b3b80d8

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

index 617df1b..89d0df2 100644 (file)
@@ -650,4 +650,22 @@ DwarfCompileUnit::constructAbstractSubprogramScopeDIE(LexicalScope *Scope) {
   return AbsDef;
 }
 
+void DwarfCompileUnit::finishSubprogramDefinition(DISubprogram SP) {
+  DIE *D = getDIE(SP);
+  if (DIE *AbsSPDIE = DD->getAbstractSPDies().lookup(SP)) {
+    if (D)
+      // If this subprogram has an abstract definition, reference that
+      addDIEEntry(*D, dwarf::DW_AT_abstract_origin, *AbsSPDIE);
+  } else {
+    if (!D && getCUNode().getEmissionKind() != DIBuilder::LineTablesOnly)
+      // Lazily construct the subprogram if we didn't see either concrete or
+      // inlined versions during codegen. (except in -gmlt ^ where we want
+      // to omit these entirely)
+      D = getOrCreateSubprogramDIE(SP);
+    if (D)
+      // And attach the attributes
+      applySubprogramAttributesToDefinition(SP, *D);
+  }
+}
+
 } // end llvm namespace
index caa6efc..04748ba 100644 (file)
@@ -122,6 +122,8 @@ public:
   DIE *createAndAddScopeChildren(LexicalScope *Scope, DIE &ScopeDIE);
 
   DIE &constructAbstractSubprogramScopeDIE(LexicalScope *Scope);
+
+  void finishSubprogramDefinition(DISubprogram SP);
 };
 
 } // end llvm namespace
index a021185..e9b93bb 100644 (file)
@@ -530,21 +530,7 @@ void DwarfDebug::finishSubprogramDefinitions() {
       // folding, etc), in which case ignore it here.
       if (SPMap[SP] != SPCU)
         continue;
-      DIE *D = SPCU->getDIE(SP);
-      if (DIE *AbsSPDIE = AbstractSPDies.lookup(SP)) {
-        if (D)
-          // If this subprogram has an abstract definition, reference that
-          SPCU->addDIEEntry(*D, dwarf::DW_AT_abstract_origin, *AbsSPDIE);
-      } else {
-        if (!D && TheCU.getEmissionKind() != DIBuilder::LineTablesOnly)
-          // Lazily construct the subprogram if we didn't see either concrete or
-          // inlined versions during codegen. (except in -gmlt ^ where we want
-          // to omit these entirely)
-          D = SPCU->getOrCreateSubprogramDIE(SP);
-        if (D)
-          // And attach the attributes
-          SPCU->applySubprogramAttributesToDefinition(SP, *D);
-      }
+      SPCU->finishSubprogramDefinition(SP);
     }
   }
 }