forked from OSchip/llvm-project
If a global var decl has an initializer, make sure to always set its linkage to external.
llvm-svn: 60462
This commit is contained in:
parent
cc78cdf275
commit
6a113d9ddb
|
@ -607,6 +607,8 @@ void CodeGenModule::EmitGlobalVarDefinition(const VarDecl *D) {
|
|||
case VarDecl::None:
|
||||
if (!D->getInit())
|
||||
GV->setLinkage(llvm::GlobalVariable::CommonLinkage);
|
||||
else
|
||||
GV->setLinkage(llvm::GlobalVariable::ExternalLinkage);
|
||||
break;
|
||||
case VarDecl::Extern:
|
||||
case VarDecl::PrivateExtern:
|
||||
|
|
|
@ -0,0 +1,7 @@
|
|||
// RUN: clang -emit-llvm -o - %s | not grep "common"
|
||||
|
||||
// This checks that the global won't be marked as common.
|
||||
// (It shouldn't because it's being initialized).
|
||||
|
||||
int a;
|
||||
int a = 242;
|
Loading…
Reference in New Issue