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
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
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
13  // CHECK-TEST1: @_ZTSPN5Test11AE = linkonce_odr hidden constant
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
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}
36