blob: 40cee061942a326f6a8366930c1ffa9331306e11 [file] [log] [blame]
Anders Carlsson806f9a32011-01-29 22:39:23 +00001// 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 Carlsson3361cff2011-01-29 19:52:22 +00003// 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
9namespace 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 Carlsson907c8282011-01-29 22:10:32 +000013 // CHECK-TEST1: @_ZTSPN5Test11AE = linkonce_odr hidden constant
Anders Carlsson3361cff2011-01-29 19:52:22 +000014 // 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
23namespace 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}