[cfe-commits] r147405 - in /cfe/trunk: lib/AST/Decl.cpp test/CodeGenCXX/visibility.cpp
Rafael Espindola
rafael.espindola at gmail.com
Sun Jan 1 10:06:40 PST 2012
Author: rafael
Date: Sun Jan 1 12:06:40 2012
New Revision: 147405
URL: http://llvm.org/viewvc/llvm-project?rev=147405&view=rev
Log:
Consider visibility attributes in namespaces as being explicit. I.e., they
take precedence over command line options. Fixes PR10113.
Modified:
cfe/trunk/lib/AST/Decl.cpp
cfe/trunk/test/CodeGenCXX/visibility.cpp
Modified: cfe/trunk/lib/AST/Decl.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/AST/Decl.cpp?rev=147405&r1=147404&r2=147405&view=diff
==============================================================================
--- cfe/trunk/lib/AST/Decl.cpp (original)
+++ cfe/trunk/lib/AST/Decl.cpp Sun Jan 1 12:06:40 2012
@@ -300,7 +300,7 @@
const NamespaceDecl *ND = dyn_cast<NamespaceDecl>(DC);
if (!ND) continue;
if (llvm::Optional<Visibility> Vis = ND->getExplicitVisibility()) {
- LV.setVisibility(*Vis, false);
+ LV.setVisibility(*Vis, true);
F.ConsiderGlobalVisibility = false;
break;
}
Modified: cfe/trunk/test/CodeGenCXX/visibility.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGenCXX/visibility.cpp?rev=147405&r1=147404&r2=147405&view=diff
==============================================================================
--- cfe/trunk/test/CodeGenCXX/visibility.cpp (original)
+++ cfe/trunk/test/CodeGenCXX/visibility.cpp Sun Jan 1 12:06:40 2012
@@ -454,3 +454,15 @@
// CHECK-HIDDEN: declare void @_ZN6test221BINS_2A2EE3fooEv()
// CHECK-HIDDEN: define linkonce_odr hidden void @_ZN6test221BINS_2A2EE3barEv()
}
+
+namespace PR10113 {
+ namespace foo __attribute__ ((__visibility__ ("default"))) {
+ template<typename T>
+ class bar {
+ void zed() {}
+ };
+ }
+ template class foo::bar<char>;
+ // CHECK: define weak_odr void @_ZN7PR101133foo3barIcE3zedEv
+ // CHECK-HIDDEN: define weak_odr void @_ZN7PR101133foo3barIcE3zedEv
+}
More information about the cfe-commits
mailing list