Switch GlobalVariable ctors to a sane API, where *either* a context or a module is required.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@75025 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/lib/Analysis/DebugInfo.cpp b/lib/Analysis/DebugInfo.cpp
index 363ecab..491cc3f 100644
--- a/lib/Analysis/DebugInfo.cpp
+++ b/lib/Analysis/DebugInfo.cpp
@@ -490,9 +490,9 @@
   Constant *ConstStr = VMContext.getConstantArray(String);
     
   // Otherwise create and return a new string global.
-  GlobalVariable *StrGV = new GlobalVariable(VMContext,ConstStr->getType(), true,
+  GlobalVariable *StrGV = new GlobalVariable(M, ConstStr->getType(), true,
                                              GlobalVariable::InternalLinkage,
-                                             ConstStr, ".str", &M);
+                                             ConstStr, ".str");
   StrGV->setSection("llvm.metadata");
   return Slot = VMContext.getConstantExprBitCast(StrGV, DestTy);
 }
@@ -516,9 +516,9 @@
   DIDescriptor &Entry = SimpleConstantCache[Init];
   if (!Entry.isNull()) return DIArray(Entry.getGV());
   
-  GlobalVariable *GV = new GlobalVariable(VMContext, Init->getType(), true,
+  GlobalVariable *GV = new GlobalVariable(M, Init->getType(), true,
                                           GlobalValue::InternalLinkage,
-                                          Init, "llvm.dbg.array", &M);
+                                          Init, "llvm.dbg.array");
   GV->setSection("llvm.metadata");
   Entry = DIDescriptor(GV);
   return DIArray(GV);
@@ -542,9 +542,9 @@
   
   M.addTypeName("llvm.dbg.subrange.type", Init->getType());
 
-  GlobalVariable *GV = new GlobalVariable(VMContext, Init->getType(), true,
+  GlobalVariable *GV = new GlobalVariable(M, Init->getType(), true,
                                           GlobalValue::InternalLinkage,
-                                          Init, "llvm.dbg.subrange", &M);
+                                          Init, "llvm.dbg.subrange");
   GV->setSection("llvm.metadata");
   Entry = DIDescriptor(GV);
   return DISubrange(GV);
@@ -579,9 +579,9 @@
                                              sizeof(Elts)/sizeof(Elts[0]));
   
   M.addTypeName("llvm.dbg.compile_unit.type", Init->getType());
-  GlobalVariable *GV = new GlobalVariable(VMContext, Init->getType(), true,
+  GlobalVariable *GV = new GlobalVariable(M, Init->getType(), true,
                                           GlobalValue::LinkOnceAnyLinkage,
-                                          Init, "llvm.dbg.compile_unit", &M);
+                                          Init, "llvm.dbg.compile_unit");
   GV->setSection("llvm.metadata");
   return DICompileUnit(GV);
 }
@@ -598,9 +598,9 @@
                                              sizeof(Elts)/sizeof(Elts[0]));
   
   M.addTypeName("llvm.dbg.enumerator.type", Init->getType());
-  GlobalVariable *GV = new GlobalVariable(VMContext, Init->getType(), true,
+  GlobalVariable *GV = new GlobalVariable(M, Init->getType(), true,
                                           GlobalValue::InternalLinkage,
-                                          Init, "llvm.dbg.enumerator", &M);
+                                          Init, "llvm.dbg.enumerator");
   GV->setSection("llvm.metadata");
   return DIEnumerator(GV);
 }
@@ -632,9 +632,9 @@
                                              sizeof(Elts)/sizeof(Elts[0]));
   
   M.addTypeName("llvm.dbg.basictype.type", Init->getType());
-  GlobalVariable *GV = new GlobalVariable(VMContext, Init->getType(), true,
+  GlobalVariable *GV = new GlobalVariable(M, Init->getType(), true,
                                           GlobalValue::InternalLinkage,
-                                          Init, "llvm.dbg.basictype", &M);
+                                          Init, "llvm.dbg.basictype");
   GV->setSection("llvm.metadata");
   return DIBasicType(GV);
 }
@@ -668,9 +668,9 @@
                                              sizeof(Elts)/sizeof(Elts[0]));
   
   M.addTypeName("llvm.dbg.derivedtype.type", Init->getType());
-  GlobalVariable *GV = new GlobalVariable(VMContext, Init->getType(), true,
+  GlobalVariable *GV = new GlobalVariable(M, Init->getType(), true,
                                           GlobalValue::InternalLinkage,
-                                          Init, "llvm.dbg.derivedtype", &M);
+                                          Init, "llvm.dbg.derivedtype");
   GV->setSection("llvm.metadata");
   return DIDerivedType(GV);
 }
@@ -708,9 +708,9 @@
                                              sizeof(Elts)/sizeof(Elts[0]));
   
   M.addTypeName("llvm.dbg.composite.type", Init->getType());
-  GlobalVariable *GV = new GlobalVariable(VMContext, Init->getType(), true,
+  GlobalVariable *GV = new GlobalVariable(M, Init->getType(), true,
                                           GlobalValue::InternalLinkage,
-                                          Init, "llvm.dbg.composite", &M);
+                                          Init, "llvm.dbg.composite");
   GV->setSection("llvm.metadata");
   return DICompositeType(GV);
 }
@@ -746,9 +746,9 @@
                                              sizeof(Elts)/sizeof(Elts[0]));
   
   M.addTypeName("llvm.dbg.subprogram.type", Init->getType());
-  GlobalVariable *GV = new GlobalVariable(VMContext, Init->getType(), true,
+  GlobalVariable *GV = new GlobalVariable(M, Init->getType(), true,
                                           GlobalValue::LinkOnceAnyLinkage,
-                                          Init, "llvm.dbg.subprogram", &M);
+                                          Init, "llvm.dbg.subprogram");
   GV->setSection("llvm.metadata");
   return DISubprogram(GV);
 }
@@ -780,9 +780,9 @@
                                              sizeof(Elts)/sizeof(Elts[0]));
   
   M.addTypeName("llvm.dbg.global_variable.type", Init->getType());
-  GlobalVariable *GV = new GlobalVariable(VMContext, Init->getType(), true,
+  GlobalVariable *GV = new GlobalVariable(M, Init->getType(), true,
                                           GlobalValue::LinkOnceAnyLinkage,
-                                          Init, "llvm.dbg.global_variable", &M);
+                                          Init, "llvm.dbg.global_variable");
   GV->setSection("llvm.metadata");
   return DIGlobalVariable(GV);
 }
@@ -806,9 +806,9 @@
                                              sizeof(Elts)/sizeof(Elts[0]));
   
   M.addTypeName("llvm.dbg.variable.type", Init->getType());
-  GlobalVariable *GV = new GlobalVariable(VMContext, Init->getType(), true,
+  GlobalVariable *GV = new GlobalVariable(M, Init->getType(), true,
                                           GlobalValue::InternalLinkage,
-                                          Init, "llvm.dbg.variable", &M);
+                                          Init, "llvm.dbg.variable");
   GV->setSection("llvm.metadata");
   return DIVariable(GV);
 }
@@ -826,9 +826,9 @@
                                              sizeof(Elts)/sizeof(Elts[0]));
   
   M.addTypeName("llvm.dbg.block.type", Init->getType());
-  GlobalVariable *GV = new GlobalVariable(VMContext, Init->getType(), true,
+  GlobalVariable *GV = new GlobalVariable(M, Init->getType(), true,
                                           GlobalValue::InternalLinkage,
-                                          Init, "llvm.dbg.block", &M);
+                                          Init, "llvm.dbg.block");
   GV->setSection("llvm.metadata");
   return DIBlock(GV);
 }