Fix the regressions handling unnamed global variables
authorChris Lattner <sabre@nondot.org>
Fri, 16 Jul 2004 01:18:09 +0000 (01:18 +0000)
committerChris Lattner <sabre@nondot.org>
Fri, 16 Jul 2004 01:18:09 +0000 (01:18 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@14870 91177308-0d34-0410-b5e6-96231b3b80d8

lib/AsmParser/llvmAsmParser.y

index 5029ef81ae968e675ac0f179629b3346aa2938a7..699ef8f3a8e7a7f1ef5ae053bd8e6ecaf1c07b88 100644 (file)
@@ -561,6 +561,7 @@ static void ParseGlobalVariable(char *NameStr,GlobalValue::LinkageTypes Linkage,
     GV->setInitializer(Initializer);
     GV->setLinkage(Linkage);
     GV->setConstant(isConstantGlobal);
+    InsertValue(GV, CurModule.Values);
     return;
   }
 
@@ -595,8 +596,10 @@ static void ParseGlobalVariable(char *NameStr,GlobalValue::LinkageTypes Linkage,
   }
 
   // Otherwise there is no existing GV to use, create one now.
-  new GlobalVariable(Ty, isConstantGlobal, Linkage, Initializer, Name, 
-                     CurModule.CurrentModule);
+  GlobalVariable *GV =
+    new GlobalVariable(Ty, isConstantGlobal, Linkage, Initializer, Name, 
+                       CurModule.CurrentModule);
+  InsertValue(GV, CurModule.Values);
 }
 
 // setTypeName - Set the specified type to the name given.  The name may be