xref: /minix3/external/bsd/llvm/dist/clang/test/CodeGenCXX/rtti-visibility.cpp (revision 0a6a1f1d05b60e214de2f05a7310ddd1f0e590e7)
1f4a2713aSLionel Sambuc // RUN: %clang_cc1 %s -I%S -triple=x86_64-apple-darwin10 -emit-llvm -o %t
2f4a2713aSLionel Sambuc // RUN: FileCheck --check-prefix=CHECK-TEST1 %s < %t
3f4a2713aSLionel Sambuc // RUN: FileCheck --check-prefix=CHECK-TEST2 %s < %t
4f4a2713aSLionel Sambuc 
5f4a2713aSLionel Sambuc #include <typeinfo>
6f4a2713aSLionel Sambuc 
7f4a2713aSLionel Sambuc namespace Test1 {
8f4a2713aSLionel Sambuc   // A is explicitly marked hidden, so all RTTI data should also be marked hidden.
9f4a2713aSLionel Sambuc   // CHECK-TEST1: @_ZTSN5Test11AE = linkonce_odr hidden constant
10*0a6a1f1dSLionel Sambuc   // CHECK-TEST1: @_ZTIN5Test11AE = linkonce_odr hidden constant
11f4a2713aSLionel Sambuc   // CHECK-TEST1: @_ZTSPN5Test11AE = linkonce_odr hidden constant
12*0a6a1f1dSLionel Sambuc   // CHECK-TEST1: @_ZTIPN5Test11AE = linkonce_odr hidden constant
13f4a2713aSLionel Sambuc   struct __attribute__((visibility("hidden"))) A { };
14f4a2713aSLionel Sambuc 
f()15f4a2713aSLionel Sambuc   void f() {
16f4a2713aSLionel Sambuc     (void)typeid(A);
17f4a2713aSLionel Sambuc     (void)typeid(A *);
18f4a2713aSLionel Sambuc   }
19f4a2713aSLionel Sambuc }
20f4a2713aSLionel Sambuc 
21f4a2713aSLionel Sambuc namespace Test2 {
22f4a2713aSLionel Sambuc   // A is weak, so its linkage should be linkoce_odr, but not marked hidden.
23f4a2713aSLionel Sambuc   // CHECK-TEST2: @_ZTSN5Test21AE = linkonce_odr constant
24*0a6a1f1dSLionel Sambuc   // CHECK-TEST2: @_ZTIN5Test21AE = linkonce_odr constant
25f4a2713aSLionel Sambuc   struct A { };
f()26f4a2713aSLionel Sambuc   void f() {
27f4a2713aSLionel Sambuc     (void)typeid(A);
28f4a2713aSLionel Sambuc   }
29f4a2713aSLionel Sambuc }
30