summaryrefslogtreecommitdiffstats
path: root/clang/lib/CodeGen/CodeGenModule.cpp
diff options
context:
space:
mode:
authorChris Lattner <sabre@nondot.org>2008-05-04 01:44:26 +0000
committerChris Lattner <sabre@nondot.org>2008-05-04 01:44:26 +0000
commitbc22b5b3278b44e6ae4406ad6ac79f1cab731b0f (patch)
tree37edb04dfe1493acc35aaa23d269645db8614da6 /clang/lib/CodeGen/CodeGenModule.cpp
parentcfcabaeb7f5209cc7896d7000507f6401e74abf5 (diff)
downloadbcm5719-llvm-bc22b5b3278b44e6ae4406ad6ac79f1cab731b0f.tar.gz
bcm5719-llvm-bc22b5b3278b44e6ae4406ad6ac79f1cab731b0f.zip
if a decl is both 'static' and weak or static and inline, its linkage
type should be internal, not weak/linkonce. llvm-svn: 50611
Diffstat (limited to 'clang/lib/CodeGen/CodeGenModule.cpp')
-rw-r--r--clang/lib/CodeGen/CodeGenModule.cpp13
1 files changed, 6 insertions, 7 deletions
diff --git a/clang/lib/CodeGen/CodeGenModule.cpp b/clang/lib/CodeGen/CodeGenModule.cpp
index bf1f0d823d7..306abd120bd 100644
--- a/clang/lib/CodeGen/CodeGenModule.cpp
+++ b/clang/lib/CodeGen/CodeGenModule.cpp
@@ -459,17 +459,19 @@ void CodeGenModule::EmitGlobalVarInit(const VarDecl *D) {
// FIXME: else handle -fvisibility
// Set the llvm linkage type as appropriate.
- if (D->getAttr<DLLImportAttr>())
+ if (D->getStorageClass() == VarDecl::Static)
+ GV->setLinkage(llvm::Function::InternalLinkage);
+ else if (D->getAttr<DLLImportAttr>())
GV->setLinkage(llvm::Function::DLLImportLinkage);
else if (D->getAttr<DLLExportAttr>())
GV->setLinkage(llvm::Function::DLLExportLinkage);
- else if (D->getAttr<WeakAttr>()) {
+ else if (D->getAttr<WeakAttr>())
GV->setLinkage(llvm::GlobalVariable::WeakLinkage);
-
- } else {
+ else {
// FIXME: This isn't right. This should handle common linkage and other
// stuff.
switch (D->getStorageClass()) {
+ case VarDecl::Static: assert(0 && "This case handled above");
case VarDecl::Auto:
case VarDecl::Register:
assert(0 && "Can't have auto or register globals");
@@ -481,9 +483,6 @@ void CodeGenModule::EmitGlobalVarInit(const VarDecl *D) {
case VarDecl::PrivateExtern:
// todo: common
break;
- case VarDecl::Static:
- GV->setLinkage(llvm::GlobalVariable::InternalLinkage);
- break;
}
}
}
OpenPOWER on IntegriCloud