]> granicus.if.org Git - clang/commitdiff
Set visibility for available_externally globals. This is important for two reasons:
authorRafael Espindola <rafael.espindola@gmail.com>
Tue, 1 Feb 2011 00:37:17 +0000 (00:37 +0000)
committerRafael Espindola <rafael.espindola@gmail.com>
Tue, 1 Feb 2011 00:37:17 +0000 (00:37 +0000)
* 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

lib/CodeGen/CodeGenModule.cpp
test/CodeGenCXX/visibility-hidden-extern-templates.cpp

index b8f91b464ddac50f509675c4a4e0e7a9cec34582..00db261649825192f3df40867ae7467dbc8d23d3 100644 (file)
@@ -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)
index 7629b77c2ceef4e212f52a96e6c85b0b2612625f..eb87ff156721ce6854defb38f7e3a9113dfb57a0 100644 (file)
@@ -20,7 +20,7 @@ void test_X(X<int> xi, X<char> xc) {
   xi.g();
   // CHECK: declare void @_ZN1XIcE1fEv
   xc.f();
-  // CHECK: define available_externally void @_ZN1XIcE1gEv
+  // CHECK: define available_externally hidden void @_ZN1XIcE1gEv
   xc.g();
 }