Eliminate unnecessary forwarding function.
authorDevang Patel <dpatel@apple.com>
Thu, 18 Aug 2011 23:17:55 +0000 (23:17 +0000)
committerDevang Patel <dpatel@apple.com>
Thu, 18 Aug 2011 23:17:55 +0000 (23:17 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@138006 91177308-0d34-0410-b5e6-96231b3b80d8

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

index 93cbdae7b0de366827885e45f6f30c66f0b82b7f..d6be3f3f5b703a06e23a59d551e181c366b16b83 100644 (file)
@@ -1035,6 +1035,9 @@ void CompileUnit::createGlobalVariableDIE(const MDNode *N) {
     return;
 
   DIGlobalVariable GV(N);
+  if (!GV.Verify())
+    return;
+
   DIE *VariableDIE = new DIE(GV.getTag());
   // Add to map.
   insertDIE(N, VariableDIE);
index d096c0b9aa667a696fb4dbde49dfc29381ea9e39..0a284fefaa7cc71bd8faf0befad64cca803aec86 100644 (file)
@@ -510,19 +510,6 @@ CompileUnit *DwarfDebug::constructCompileUnit(const MDNode *N) {
   return NewCU;
 }
 
-/// constructGlobalVariableDIE - Construct global variable DIE.
-void DwarfDebug::constructGlobalVariableDIE(CompileUnit *TheCU,
-                                            const MDNode *N) {
-  DIGlobalVariable GV(N);
-
-  // If debug information is malformed then ignore it.
-  if (GV.Verify() == false)
-    return;
-
-  TheCU->createGlobalVariableDIE(N);
-  return;
-}
-
 /// construct SubprogramDIE - Construct subprogram DIE.
 void DwarfDebug::constructSubprogramDIE(CompileUnit *TheCU, 
                                         const MDNode *N) {
@@ -561,7 +548,7 @@ void DwarfDebug::collectInfoFromNamedMDNodes(Module *M) {
     for (unsigned i = 0, e = NMD->getNumOperands(); i != e; ++i) {
       const MDNode *N = NMD->getOperand(i);
       if (CompileUnit *CU = CUMap.lookup(DIGlobalVariable(N).getCompileUnit()))
-        constructGlobalVariableDIE(CU, N);
+        CU->createGlobalVariableDIE(N);
     }
   
   if (NamedMDNode *NMD = M->getNamedMetadata("llvm.dbg.enum"))
@@ -607,7 +594,7 @@ bool DwarfDebug::collectLegacyDebugInfo(Module *M) {
          E = DbgFinder.global_variable_end(); I != E; ++I) {
     const MDNode *N = *I;
     if (CompileUnit *CU = CUMap.lookup(DIGlobalVariable(N).getCompileUnit()))
-      constructGlobalVariableDIE(CU, N);
+      CU->createGlobalVariableDIE(N);
   }
     
   // Create DIEs for each subprogram.
@@ -637,7 +624,7 @@ void DwarfDebug::beginModule(Module *M) {
       CompileUnit *CU = constructCompileUnit(CUNode);
       DIArray GVs = CUNode.getGlobalVariables();
       for (unsigned i = 0, e = GVs.getNumElements(); i != e; ++i)
-        constructGlobalVariableDIE(CU, GVs.getElement(i));
+        CU->createGlobalVariableDIE(GVs.getElement(i));
       DIArray SPs = CUNode.getSubprograms();
       for (unsigned i = 0, e = SPs.getNumElements(); i != e; ++i)
         constructSubprogramDIE(CU, SPs.getElement(i));
index 042d693a9b6c79116f30d6346f2b20e58c989700..35653be5c897e13e1e4de0ccd4254fdf5d683cfe 100644 (file)
@@ -417,9 +417,6 @@ private:
   /// metadata node with tag DW_TAG_compile_unit.
   CompileUnit *constructCompileUnit(const MDNode *N);
 
-  /// constructGlobalVariableDIE - Construct global variable DIE.
-  void constructGlobalVariableDIE(CompileUnit *TheCU, const MDNode *N);
-
   /// construct SubprogramDIE - Construct subprogram DIE.
   void constructSubprogramDIE(CompileUnit *TheCU, const MDNode *N);