From ce6ae5cb06602f519077ffd83e06b25fdc8f18f8 Mon Sep 17 00:00:00 2001 From: Chris Lattner Date: Sat, 2 Feb 2008 04:43:11 +0000 Subject: 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 }; llvm-svn: 46661 --- clang/CodeGen/CodeGenModule.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'clang/CodeGen/CodeGenModule.cpp') diff --git a/clang/CodeGen/CodeGenModule.cpp b/clang/CodeGen/CodeGenModule.cpp index ee84f954c56..edf3dc42831 100644 --- a/clang/CodeGen/CodeGenModule.cpp +++ b/clang/CodeGen/CodeGenModule.cpp @@ -134,7 +134,7 @@ llvm::Constant *CodeGenModule::GetAddrOfGlobalVar(const VarDecl *D, 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) { -- cgit v1.2.3