Anders Carlsson | 806f9a3 | 2011-01-29 22:39:23 +0000 | [diff] [blame] | 1 | // RUN: %clang_cc1 %s -I%S -triple=x86_64-apple-darwin10 -emit-llvm -o %t |
| 2 | // RUN: %clang_cc1 %s -I%S -triple=x86_64-apple-darwin10 -fhidden-weak-vtables -emit-llvm -o %t.hidden |
Anders Carlsson | 3361cff | 2011-01-29 19:52:22 +0000 | [diff] [blame] | 3 | // RUN: FileCheck --check-prefix=CHECK-TEST1 %s < %t |
| 4 | // RUN: FileCheck --check-prefix=CHECK-TEST2 %s < %t |
| 5 | // RUN: FileCheck --check-prefix=CHECK-TEST2-HIDDEN %s < %t.hidden |
| 6 | |
| 7 | #include <typeinfo> |
| 8 | |
| 9 | namespace Test1 { |
| 10 | // A is explicitly marked hidden, so all RTTI data should also be marked hidden. |
| 11 | // CHECK-TEST1: @_ZTSN5Test11AE = linkonce_odr hidden constant |
| 12 | // CHECK-TEST1: @_ZTIN5Test11AE = linkonce_odr hidden unnamed_addr constant |
Anders Carlsson | 907c828 | 2011-01-29 22:10:32 +0000 | [diff] [blame] | 13 | // CHECK-TEST1: @_ZTSPN5Test11AE = linkonce_odr hidden constant |
Anders Carlsson | 3361cff | 2011-01-29 19:52:22 +0000 | [diff] [blame] | 14 | // CHECK-TEST1: @_ZTIPN5Test11AE = linkonce_odr hidden unnamed_addr constant |
| 15 | struct __attribute__((visibility("hidden"))) A { }; |
| 16 | |
| 17 | void f() { |
| 18 | (void)typeid(A); |
| 19 | (void)typeid(A *); |
| 20 | } |
| 21 | } |
| 22 | |
| 23 | namespace Test2 { |
| 24 | // A is weak, so its linkage should be linkoce_odr, but not marked hidden. |
| 25 | // CHECK-TEST2: @_ZTSN5Test21AE = linkonce_odr constant |
| 26 | // CHECK-TEST2: @_ZTIN5Test21AE = linkonce_odr unnamed_addr constant |
| 27 | struct A { }; |
| 28 | |
| 29 | // With -fhidden-weak-vtables, the typeinfo for A is marked hidden, but not its name. |
| 30 | // CHECK-TEST2-HIDDEN: _ZTSN5Test21AE = linkonce_odr constant |
| 31 | // CHECK-TEST2-HIDDEN: @_ZTIN5Test21AE = linkonce_odr hidden unnamed_addr constant |
| 32 | void f() { |
| 33 | (void)typeid(A); |
| 34 | } |
| 35 | } |