DwarfCompileUnit: Add type safety to createGlobalVariableDIE
authorDavid Blaikie <dblaikie@gmail.com>
Sun, 17 Nov 2013 21:55:13 +0000 (21:55 +0000)
committerDavid Blaikie <dblaikie@gmail.com>
Sun, 17 Nov 2013 21:55:13 +0000 (21:55 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@194979 91177308-0d34-0410-b5e6-96231b3b80d8

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

index cb0e89977c1965a3fc3ce2bb0fac85a73de2edbb..59a4842b04b9d59f3c114d8867b4f9bbe4accec3 100644 (file)
@@ -1508,8 +1508,7 @@ static const ConstantExpr *getMergedGlobalExpr(const Value *V) {
 }
 
 /// createGlobalVariableDIE - create global variable DIE.
-void CompileUnit::createGlobalVariableDIE(const MDNode *N) {
-  DIGlobalVariable GV(N);
+void CompileUnit::createGlobalVariableDIE(DIGlobalVariable GV) {
 
   // Check for pre-existence.
   if (getDIE(GV))
@@ -1617,7 +1616,7 @@ void CompileUnit::createGlobalVariableDIE(const MDNode *N) {
     // it is not a static member.
     if (!IsStaticMember)
       addConstantValue(VariableDIE, CI, isUnsignedDIType(DD, GTy));
-  } else if (const ConstantExpr *CE = getMergedGlobalExpr(N->getOperand(11))) {
+  } else if (const ConstantExpr *CE = getMergedGlobalExpr(GV->getOperand(11))) {
     addToAccelTable = true;
     // GV is a merged global.
     DIEBlock *Block = new (DIEValueAllocator) DIEBlock();
index 884e51a7ef8a7cb63a826706354dad0d40d1daea..d782c88a510d381eed0df0438a9eaf9718adf55e 100644 (file)
@@ -310,7 +310,7 @@ public:
   DIE *getOrCreateContextDIE(DIScope Context);
 
   /// createGlobalVariableDIE - create global variable DIE.
-  void createGlobalVariableDIE(const MDNode *N);
+  void createGlobalVariableDIE(DIGlobalVariable GV);
 
   /// constructContainingTypeDIEs - Construct DIEs for types that contain
   /// vtables.
index 20e61cd4c9e2dc9e9a1e053892916b8648a4533e..068bce5f5de7a0fd3a5379d9d9788e10a8bc212a 100644 (file)
@@ -923,7 +923,7 @@ void DwarfDebug::beginModule() {
               ScopesWithImportedEntities.end(), less_first());
     DIArray GVs = CUNode.getGlobalVariables();
     for (unsigned i = 0, e = GVs.getNumElements(); i != e; ++i)
-      CU->createGlobalVariableDIE(GVs.getElement(i));
+      CU->createGlobalVariableDIE(DIGlobalVariable(GVs.getElement(i)));
     DIArray SPs = CUNode.getSubprograms();
     for (unsigned i = 0, e = SPs.getNumElements(); i != e; ++i)
       constructSubprogramDIE(CU, SPs.getElement(i));