1 // RUN: %clang_cc1 %s -std=c++11 -triple=x86_64-apple-darwin10 -emit-llvm -o %t.ll
2 // RUN: FileCheck %s -check-prefix=FUNS < %t.ll
3 // RUN: FileCheck %s -check-prefix=VARS < %t.ll
4 // RUN: %clang_cc1 %s -std=c++11 -triple=x86_64-apple-darwin10 -fvisibility=hidden -emit-llvm -o %t.ll
5 // RUN: FileCheck %s -check-prefix=FUNS-HIDDEN < %t.ll
6 // RUN: FileCheck %s -check-prefix=VARS-HIDDEN < %t.ll
8 #define HIDDEN __attribute__((visibility("hidden")))
9 #define PROTECTED __attribute__((visibility("protected")))
10 #define DEFAULT __attribute__((visibility("default")))
11 #define TYPE_HIDDEN __attribute__((type_visibility("hidden")))
12 #define TYPE_PROTECTED __attribute__((type_visibility("protected")))
13 #define TYPE_DEFAULT __attribute__((type_visibility("default")))
15 #if !__has_attribute(type_visibility)
16 #error No type_visibility attribute!
19 // The template tests come first because IR-gen reorders RTTI wierdly.
22 template <class T
> struct TYPE_DEFAULT B
{
27 // FUNS-LABEL: define weak_odr void @_ZN5temp01BINS_1AEE3fooEv(
28 // VARS: @_ZTVN5temp01BINS_1AEEE = weak_odr unnamed_addr constant
29 // VARS: @_ZTSN5temp01BINS_1AEEE = weak_odr constant
30 // VARS: @_ZTIN5temp01BINS_1AEEE = weak_odr constant
31 // FUNS-HIDDEN-LABEL: define weak_odr hidden void @_ZN5temp01BINS_1AEE3fooEv(
32 // VARS-HIDDEN: @_ZTVN5temp01BINS_1AEEE = weak_odr hidden unnamed_addr constant
33 // VARS-HIDDEN: @_ZTSN5temp01BINS_1AEEE = weak_odr hidden constant
34 // VARS-HIDDEN: @_ZTIN5temp01BINS_1AEEE = weak_odr hidden constant
38 struct TYPE_DEFAULT A
;
39 template <class T
> struct TYPE_DEFAULT B
{
44 // FUNS-LABEL: define weak_odr void @_ZN5temp11BINS_1AEE3fooEv(
45 // VARS: @_ZTVN5temp11BINS_1AEEE = weak_odr unnamed_addr constant
46 // VARS: @_ZTSN5temp11BINS_1AEEE = weak_odr constant
47 // VARS: @_ZTIN5temp11BINS_1AEEE = weak_odr constant
48 // FUNS-HIDDEN-LABEL: define weak_odr hidden void @_ZN5temp11BINS_1AEE3fooEv(
49 // VARS-HIDDEN: @_ZTVN5temp11BINS_1AEEE = weak_odr unnamed_addr constant
50 // VARS-HIDDEN: @_ZTSN5temp11BINS_1AEEE = weak_odr constant
51 // VARS-HIDDEN: @_ZTIN5temp11BINS_1AEEE = weak_odr constant
55 struct TYPE_DEFAULT A
;
56 template <class T
> struct B
{
61 // FUNS-LABEL: define weak_odr void @_ZN5temp21BINS_1AEE3fooEv(
62 // VARS: @_ZTVN5temp21BINS_1AEEE = weak_odr unnamed_addr constant
63 // VARS: @_ZTSN5temp21BINS_1AEEE = weak_odr constant
64 // VARS: @_ZTIN5temp21BINS_1AEEE = weak_odr constant
65 // FUNS-HIDDEN-LABEL: define weak_odr hidden void @_ZN5temp21BINS_1AEE3fooEv(
66 // VARS-HIDDEN: @_ZTVN5temp21BINS_1AEEE = weak_odr hidden unnamed_addr constant
67 // VARS-HIDDEN: @_ZTSN5temp21BINS_1AEEE = weak_odr hidden constant
68 // VARS-HIDDEN: @_ZTIN5temp21BINS_1AEEE = weak_odr hidden constant
73 template <class T
> struct TYPE_DEFAULT B
{
78 // FUNS-LABEL: define weak_odr hidden void @_ZN5temp31BINS_1AEE3fooEv(
79 // VARS: @_ZTVN5temp31BINS_1AEEE = weak_odr hidden unnamed_addr constant
80 // VARS: @_ZTSN5temp31BINS_1AEEE = weak_odr hidden constant
81 // VARS: @_ZTIN5temp31BINS_1AEEE = weak_odr hidden constant
82 // FUNS-HIDDEN-LABEL: define weak_odr hidden void @_ZN5temp31BINS_1AEE3fooEv(
83 // VARS-HIDDEN: @_ZTVN5temp31BINS_1AEEE = weak_odr hidden unnamed_addr constant
84 // VARS-HIDDEN: @_ZTSN5temp31BINS_1AEEE = weak_odr hidden constant
85 // VARS-HIDDEN: @_ZTIN5temp31BINS_1AEEE = weak_odr hidden constant
89 struct TYPE_DEFAULT A
;
90 template <class T
> struct TYPE_HIDDEN B
{
95 // FUNS-LABEL: define weak_odr void @_ZN5temp41BINS_1AEE3fooEv(
96 // VARS: @_ZTVN5temp41BINS_1AEEE = weak_odr hidden unnamed_addr constant
97 // VARS: @_ZTSN5temp41BINS_1AEEE = weak_odr hidden constant
98 // VARS: @_ZTIN5temp41BINS_1AEEE = weak_odr hidden constant
99 // FUNS-HIDDEN-LABEL: define weak_odr hidden void @_ZN5temp41BINS_1AEE3fooEv(
100 // VARS-HIDDEN: @_ZTVN5temp41BINS_1AEEE = weak_odr hidden unnamed_addr constant
101 // VARS-HIDDEN: @_ZTSN5temp41BINS_1AEEE = weak_odr hidden constant
102 // VARS-HIDDEN: @_ZTIN5temp41BINS_1AEEE = weak_odr hidden constant
106 struct TYPE_DEFAULT A
{
111 // FUNS-LABEL: define void @_ZN5type01A3fooEv(
112 // VARS: @_ZTVN5type01AE = unnamed_addr constant
113 // VARS: @_ZTSN5type01AE = constant
114 // VARS: @_ZTIN5type01AE = constant
115 // FUNS-HIDDEN-LABEL: define hidden void @_ZN5type01A3fooEv(
116 // VARS-HIDDEN: @_ZTVN5type01AE = unnamed_addr constant
117 // VARS-HIDDEN: @_ZTSN5type01AE = constant
118 // VARS-HIDDEN: @_ZTIN5type01AE = constant
122 struct HIDDEN TYPE_DEFAULT A
{
127 // FUNS-LABEL: define hidden void @_ZN5type11A3fooEv(
128 // VARS: @_ZTVN5type11AE = unnamed_addr constant
129 // VARS: @_ZTSN5type11AE = constant
130 // VARS: @_ZTIN5type11AE = constant
131 // FUNS-HIDDEN-LABEL: define hidden void @_ZN5type11A3fooEv(
132 // VARS-HIDDEN: @_ZTVN5type11AE = unnamed_addr constant
133 // VARS-HIDDEN: @_ZTSN5type11AE = constant
134 // VARS-HIDDEN: @_ZTIN5type11AE = constant
138 struct TYPE_HIDDEN A
{
143 // FUNS-LABEL: define void @_ZN5type21A3fooEv(
144 // VARS: @_ZTVN5type21AE = hidden unnamed_addr constant
145 // VARS: @_ZTSN5type21AE = hidden constant
146 // VARS: @_ZTIN5type21AE = hidden constant
147 // FUNS-HIDDEN-LABEL: define hidden void @_ZN5type21A3fooEv(
148 // VARS-HIDDEN: @_ZTVN5type21AE = hidden unnamed_addr constant
149 // VARS-HIDDEN: @_ZTSN5type21AE = hidden constant
150 // VARS-HIDDEN: @_ZTIN5type21AE = hidden constant
154 struct DEFAULT TYPE_HIDDEN A
{
159 // FUNS-LABEL: define void @_ZN5type31A3fooEv(
160 // VARS: @_ZTVN5type31AE = hidden unnamed_addr constant
161 // VARS: @_ZTSN5type31AE = hidden constant
162 // VARS: @_ZTIN5type31AE = hidden constant
163 // FUNS-HIDDEN-LABEL: define void @_ZN5type31A3fooEv(
164 // VARS-HIDDEN: @_ZTVN5type31AE = hidden unnamed_addr constant
165 // VARS-HIDDEN: @_ZTSN5type31AE = hidden constant
166 // VARS-HIDDEN: @_ZTIN5type31AE = hidden constant