summaryrefslogtreecommitdiffstats
path: root/clang/test
diff options
context:
space:
mode:
authorJohn McCall <rjmccall@apple.com>2010-12-10 02:59:44 +0000
committerJohn McCall <rjmccall@apple.com>2010-12-10 02:59:44 +0000
commit2faf32c4fdcaf65ffef3dcbb9cb12e520c4d7561 (patch)
tree0867fa44da6f34bd6aab2e0de376349f40bd85e1 /clang/test
parentb761ee687f982a12c9b6d93a292a84af431bec7d (diff)
downloadbcm5719-llvm-2faf32c4fdcaf65ffef3dcbb9cb12e520c4d7561.tar.gz
bcm5719-llvm-2faf32c4fdcaf65ffef3dcbb9cb12e520c4d7561.zip
Treat visibility on an enclosing namespace as a non-explicit source of
visibility. Fixes PR8713. I've disabled a test which was testing that you can #pragma pop visibility to get out of a namespace's visibility attribute. We should probably just diagnose that as an error unless it's instrumental to someone's system headers. llvm-svn: 121459
Diffstat (limited to 'clang/test')
-rw-r--r--clang/test/CodeGenCXX/pragma-visibility.cpp4
-rw-r--r--clang/test/CodeGenCXX/visibility-inlines-hidden.cpp18
2 files changed, 21 insertions, 1 deletions
diff --git a/clang/test/CodeGenCXX/pragma-visibility.cpp b/clang/test/CodeGenCXX/pragma-visibility.cpp
index 05de78670a0..2dc8bcc74fa 100644
--- a/clang/test/CodeGenCXX/pragma-visibility.cpp
+++ b/clang/test/CodeGenCXX/pragma-visibility.cpp
@@ -63,10 +63,12 @@ namespace n __attribute((visibility("default"))) {
#pragma GCC visibility pop
}
+// We used to test this, but it's insane, so unless it happens in
+// headers, we should not support it.
namespace n __attribute((visibility("hidden"))) {
extern int foofoo; // FIXME: Shouldn't be necessary, but otherwise the pragma
// gets to Sema before the namespace!
#pragma GCC visibility pop
void h() {}
- // CHECK: define void @_ZN1n1hEv
+ // CHECK disabled: define void @_ZN1n1hEv
}
diff --git a/clang/test/CodeGenCXX/visibility-inlines-hidden.cpp b/clang/test/CodeGenCXX/visibility-inlines-hidden.cpp
index 7f92be2abff..760879a2a63 100644
--- a/clang/test/CodeGenCXX/visibility-inlines-hidden.cpp
+++ b/clang/test/CodeGenCXX/visibility-inlines-hidden.cpp
@@ -79,3 +79,21 @@ namespace test1 {
// CHECK: declare void @_ZN5test11A3fooEv
// CHECK: declare void @_ZN5test11AD1Ev
}
+
+// PR8713
+namespace test2 {
+ struct A {};
+ template <class T> class B {};
+ typedef B<A> arg;
+
+ namespace ns __attribute__((visibility("default"))) {
+ template <class T> inline void foo() {}
+ extern template void foo<arg>();
+ }
+
+ void test() {
+ ns::foo<arg>();
+ }
+
+ // CHECK: define available_externally void @_ZN5test22ns3fooINS_1BINS_1AEEEEEvv()
+}
OpenPOWER on IntegriCloud