[cfe-commits] r46661 - /cfe/trunk/CodeGen/CodeGenModule.cpp

Chris Lattner sabre at nondot.org
Fri Feb 1 20:43:12 PST 2008


Author: lattner
Date: Fri Feb  1 22:43:11 2008
New Revision: 46661

URL: http://llvm.org/viewvc/llvm-project?rev=46661&view=rev
Log:
fix codegen on static variables which have multiple decl nodes.  These 
should be merged just like normal globals.  This fixes this testcase
that Anders provided:

static struct s a;
static struct s *ap1 = &a;
static struct s a =  { 10 };


Modified:
    cfe/trunk/CodeGen/CodeGenModule.cpp

Modified: cfe/trunk/CodeGen/CodeGenModule.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/CodeGen/CodeGenModule.cpp?rev=46661&r1=46660&r2=46661&view=diff

==============================================================================
--- cfe/trunk/CodeGen/CodeGenModule.cpp (original)
+++ cfe/trunk/CodeGen/CodeGenModule.cpp Fri Feb  1 22:43:11 2008
@@ -134,7 +134,7 @@
   const llvm::Type *Ty = getTypes().ConvertTypeForMem(D->getType());
 
   // Check to see if the global already exists.
-  llvm::GlobalVariable *GV = getModule().getGlobalVariable(D->getName());
+  llvm::GlobalVariable *GV = getModule().getGlobalVariable(D->getName(), true);
 
   // If it doesn't already exist, just create and return an entry.
   if (GV == 0) {





More information about the cfe-commits mailing list