1 // RUN: %clang_cc1 %s -emit-llvm -triple %itanium_abi_triple -std=c++11 -o - | FileCheck %s
2 // RUN: %clang_cc1 %s -emit-llvm -triple i686-linux-gnu -std=c++11 -o - | FileCheck %s
3 // RUN: %clang_cc1 %s -emit-llvm -triple x86_64-linux-gnu -std=c++11 -o - | FileCheck %s
4 // RUN: %clang_cc1 %s -emit-llvm -triple powerpc64le-unknown-linux-gnu -std=c++11 -o - | FileCheck %s
6 struct __attribute__((abi_tag("A", "B"))) A
{ };
18 struct __attribute__((abi_tag("C", "D"))) E
{
21 struct __attribute__((abi_tag("A", "B"))) F
{ };
24 // CHECK-DAG: @_Z2a1B1AB1B =
26 __attribute__((abi_tag("C", "D")))
28 // CHECK-DAG: @_Z2a2B1AB1BB1CB1D =
34 // CHECK-DAG: @_Z2a4B1AB1B =
40 // CHECK-DAG: @_Z2a6B1CB1D =
43 // CHECK-DAG: @_Z2a7B1AB1BB1CB1D =
50 // CHECK-DAG: @_ZN1EB1CB1DIfE2a8E =
57 // CHECK-DAG: @_ZN1EB1CB1DI1FB1AB1BE2a9E =
59 struct __attribute__((abi_tag("A", "B"))) A10
{
63 // CHECK-DAG: @_ZTV3A10B1AB1B =
65 // CHECK-DAG: @_ZTI3A10B1AB1B =
67 struct __attribute__((abi_tag("A"))) B11
{
71 // B11[abi:A]::b[abi:B]
72 // CHECK-DAG: @_ZN3B11B1A1bB1BE =
74 __attribute__ ((abi_tag("C", "D")))
78 // CHECK-DAG: define {{.*}} @_Z2f1B1CB1Dv(
80 __attribute__ ((abi_tag("C", "D")))
84 // CHECK-DAG: define {{.*}} @_Z2f2B1AB1BB1CB1Dv(
89 // CHECK-DAG: define {{.*}} @_Z2f3v(
94 // CHECK-DAG: define {{.*}} @_Z2f4B1AB1Bv(
99 // CHECK-DAG: define {{.*}} @_Z2f5v(
104 // CHECK-DAG: define {{.*}} @_Z2f6B1CB1Dv(
109 // CHECK-DAG: define {{.*}} @_Z2f7B1AB1BB1CB1Dv(
113 // CHECK-DAG: define {{.*}} @_Z2f8P1EB1CB1DI1AB1AB1BE(
115 inline namespace Names1
__attribute__((__abi_tag__
)) {
118 C1
f9() { return C1(); }
119 // CHECK-DAG: @_Z2f9B6Names1v(
121 inline namespace Names2
__attribute__((__abi_tag__("Tag1", "Tag2"))) {
124 C2
f10() { return C2(); }
125 // CHECK-DAG: @_Z3f10B4Tag1B4Tag2v(
127 void __attribute__((abi_tag("A"))) f11(A
) {}
128 // f11[abi:A](A[abi:A][abi:B])
129 // CHECK-DAG: define {{.*}} @_Z3f11B1A1AB1AB1B(
131 A
f12(A
) { return A(); }
132 // f12(A[abi:A][abi:B])
133 // CHECK-DAG: define {{.*}} @_Z3f121AB1AB1B(
137 static E
<int>* foo() {
147 // f13()::L::foo[abi:C][abi:D]()
148 // CHECK-DAG: define linkonce_odr {{(dso_local )?}}{{(noundef )?}}ptr @_ZZ3f13vEN1L3fooB1CB1DEv(
150 // f13()::L::foo[abi:C][abi:D]()::a[abi:A][abi:B]
151 // CHECK-DAG: @_ZZZ3f13vEN1L3fooB1CB1DEvE1aB1AB1B =
153 // guard variable for f13()::L::foo[abi:C][abi:D]()::a[abi:A][abi:B]
154 // CHECK-DAG: @_ZGVZZ3f13vEN1L3fooB1CB1DEvE1aB1AB1B =
156 struct __attribute__((abi_tag("TAG"))) A14
{
162 // A14[abi:TAG]::f14()
163 // CHECK-DAG: define {{.+}} @_ZN3A14B3TAG3f14Ev(
172 // A14[abi:TAG] f15<A14[abi:TAG]>()
173 // CHECK-DAG: define linkonce_odr {{.+}} @_Z3f15I3A14B3TAGET_v(
182 // A14[abi:TAG] f16<int>()
183 // CHECK-DAG: define linkonce_odr {{.+}} @_Z3f16IiE3A14B3TAGv(
186 struct __attribute__((abi_tag("TAG"))) A17
{
187 A17
operator+(const A17
& a
) {
195 // A17[abi:TAG]<int>::operator+(A17[abi:TAG]<int> const&)
196 // CHECK-DAG: define linkonce_odr {{.+}} @_ZN3A17B3TAGIiEplERKS0_(
199 operator A() { return A(); }
204 // A18::operator A[abi:A][abi:B]() but GCC adds the same tags twice!
205 // CHECK-DAG: define linkonce_odr {{.+}} @_ZN3A18cv1AB1AB1BEv(
209 class __attribute__((abi_tag("B"))) B
{};
213 template<typename T
, B
F(T
, D
)>
218 void f19_test(N19::C
<N19::A
, &N19::foo
>, N19::F
, N19::D
) {
220 // f19_test(N19::C<N19::A, &N19::foo[abi:B]>, N19::F, N19::D)
221 // CHECK-DAG: define {{(dso_local )?}}void @_Z8f19_testN3N191CINS_1AEXadL_ZNS_3fooB1BES1_NS_1DEEEEENS_1FES2_(
225 template<class F
> void g(F
);
226 template<class ...A
> auto h(A
...a
)->decltype (g (0, g
< a
> (a
) ...)) {
228 // CHECK-DAG: define {{.*}} @_ZN7pr304401hIJEEEDTcl1gLi0Espcl1gIXfp_EEfp_EEEDpT_(
230 void pr30440_test () {