1 // RUN: %clang_cc1 %s -std=c++11 -triple=x86_64-apple-darwin10 -fvisibility=hidden -ftype-visibility=default -emit-llvm -o %t
2 // RUN: FileCheck %s < %t
3 // RUN: FileCheck -check-prefix=CHECK-GLOBAL %s < %t
5 // The two visibility options above are how we translate
6 // -fvisibility-ms-compat in the driver.
8 #define HIDDEN __attribute__((visibility("hidden")))
9 #define PROTECTED __attribute__((visibility("protected")))
10 #define DEFAULT __attribute__((visibility("default")))
22 void A::foo() { bar(); }
23 // CHECK-LABEL: define hidden void @_ZN5test01A3fooEv()
24 // CHECK: declare void @_ZN5test01A3barEv()
26 const std::type_info
&ti
= typeid(A
);
27 // CHECK-GLOBAL: @_ZTSN5test01AE = linkonce_odr constant
28 // CHECK-GLOBAL: @_ZTIN5test01AE = linkonce_odr constant
29 // CHECK-GLOBAL: @_ZN5test02tiE = hidden constant
38 void A::foo() { bar(); }
39 // CHECK-LABEL: define hidden void @_ZN5test11A3fooEv()
40 // CHECK: declare hidden void @_ZN5test11A3barEv()
42 const std::type_info
&ti
= typeid(A
);
43 // CHECK-GLOBAL: @_ZTSN5test11AE = linkonce_odr hidden constant
44 // CHECK-GLOBAL: @_ZTIN5test11AE = linkonce_odr hidden constant
45 // CHECK-GLOBAL: @_ZN5test12tiE = hidden constant
54 void A::foo() { bar(); }
55 // CHECK-LABEL: define{{.*}} void @_ZN5test21A3fooEv()
56 // CHECK: declare void @_ZN5test21A3barEv()
58 const std::type_info
&ti
= typeid(A
);
59 // CHECK-GLOBAL: @_ZTSN5test21AE = linkonce_odr constant
60 // CHECK-GLOBAL: @_ZTIN5test21AE = linkonce_odr constant
61 // CHECK-GLOBAL: @_ZN5test22tiE = hidden constant
66 template <class T
> struct B
{
67 static void foo() { bar(); }
71 template void B
<A
>::foo();
72 // CHECK-LABEL: define weak_odr hidden void @_ZN5test31BINS_1AEE3fooEv()
73 // CHECK: declare void @_ZN5test31BINS_1AEE3barEv()
75 const std::type_info
&ti
= typeid(B
<A
>);
76 // CHECK-GLOBAL: @_ZTSN5test31BINS_1AEEE = linkonce_odr constant
77 // CHECK-GLOBAL: @_ZTIN5test31BINS_1AEEE = linkonce_odr constant
82 template <class T
> struct DEFAULT B
{
83 static void foo() { bar(); }
87 template void B
<A
>::foo();
88 // CHECK-LABEL: define weak_odr void @_ZN5test41BINS_1AEE3fooEv()
89 // CHECK: declare void @_ZN5test41BINS_1AEE3barEv()
91 const std::type_info
&ti
= typeid(B
<A
>);
92 // CHECK-GLOBAL: @_ZTSN5test41BINS_1AEEE = linkonce_odr constant
93 // CHECK-GLOBAL: @_ZTIN5test41BINS_1AEEE = linkonce_odr constant
98 template <class T
> struct HIDDEN B
{
99 static void foo() { bar(); }
103 template void B
<A
>::foo();
104 // CHECK-LABEL: define weak_odr hidden void @_ZN5test51BINS_1AEE3fooEv()
105 // CHECK: declare hidden void @_ZN5test51BINS_1AEE3barEv()
107 const std::type_info
&ti
= typeid(B
<A
>);
108 // CHECK-GLOBAL: @_ZTSN5test51BINS_1AEEE = linkonce_odr hidden constant
109 // CHECK-GLOBAL: @_ZTIN5test51BINS_1AEEE = linkonce_odr hidden constant