From: Rafael Espindola Date: Tue, 1 Feb 2011 00:37:17 +0000 (+0000) Subject: Set visibility for available_externally globals. This is important for two reasons: X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=517ebc6e13c41dc9115bc0eece93f6fc1155743e;p=clang Set visibility for available_externally globals. This is important for two reasons: * llvm-link would complains about mismatched visibility * If we produce a relocation with an available_externally, it is good to know that it is hidden. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@124633 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/lib/CodeGen/CodeGenModule.cpp b/lib/CodeGen/CodeGenModule.cpp index b8f91b464d..00db261649 100644 --- a/lib/CodeGen/CodeGenModule.cpp +++ b/lib/CodeGen/CodeGenModule.cpp @@ -174,8 +174,7 @@ void CodeGenModule::setGlobalVisibility(llvm::GlobalValue *GV, // Set visibility for definitions. NamedDecl::LinkageInfo LV = D->getLinkageAndVisibility(); - if (LV.visibilityExplicit() || !GV->hasAvailableExternallyLinkage()) - GV->setVisibility(GetLLVMVisibility(LV.visibility())); + GV->setVisibility(GetLLVMVisibility(LV.visibility())); } /// Set the symbol visibility of type information (vtable and RTTI) diff --git a/test/CodeGenCXX/visibility-hidden-extern-templates.cpp b/test/CodeGenCXX/visibility-hidden-extern-templates.cpp index 7629b77c2c..eb87ff1567 100644 --- a/test/CodeGenCXX/visibility-hidden-extern-templates.cpp +++ b/test/CodeGenCXX/visibility-hidden-extern-templates.cpp @@ -20,7 +20,7 @@ void test_X(X xi, X xc) { xi.g(); // CHECK: declare void @_ZN1XIcE1fEv xc.f(); - // CHECK: define available_externally void @_ZN1XIcE1gEv + // CHECK: define available_externally hidden void @_ZN1XIcE1gEv xc.g(); }