[clang] Handle __declspec() attributes in using
[llvm-project.git] / clang / test / CodeGenCXX / mdefault-visibility-export-mapping.cpp
blob6e61f1812f57be1dd95b7bd935b7b8499ef8fcb5
1 // RUN: %clang_cc1 -triple powerpc-ibm-aix %s -S -emit-llvm -o - | \
2 // RUN: FileCheck -check-prefixes=CHECK,UNSPECIFIED-DEF,EXPLICIT-DEF %s
3 // RUN: %clang_cc1 -triple powerpc-ibm-aix %s -mdefault-visibility-export-mapping=none -S -emit-llvm -o - | \
4 // RUN: FileCheck -check-prefixes=CHECK,UNSPECIFIED-DEF,EXPLICIT-DEF %s
5 // RUN: %clang_cc1 -triple powerpc-ibm-aix %s -mdefault-visibility-export-mapping=explicit -S -emit-llvm -o - | \
6 // RUN: FileCheck -check-prefixes=CHECK,UNSPECIFIED-DEF,EXPLICIT-EXP %s
7 // RUN: %clang_cc1 -triple powerpc-ibm-aix %s -mdefault-visibility-export-mapping=all -S -emit-llvm -o - | \
8 // RUN: FileCheck -check-prefixes=CHECK,UNSPECIFIED-EXP,EXPLICIT-EXP %s
10 struct A {};
12 template <class T>
13 class B {
14 public:
15 T x;
16 B(T _x) : x(_x) {}
17 ~B() {}
18 void func(T x) {}
21 template <class T>
22 class __attribute__((visibility("default"))) C {
23 public:
24 T x;
25 C(T _x) : x(_x) {}
26 ~C() {}
27 void func(T x) {}
30 class D {
31 public:
32 ~D();
35 D::~D() {}
37 extern template class B<int>;
38 extern template class C<int>;
40 void func() {
41 B<A> x({});
42 C<A> y({});
43 x.func({});
44 y.func({});
45 B<int> xi(0);
46 C<int> yi(0);
47 xi.func(0);
48 yi.func(0);
49 D z;
52 // D::~D() (base object destructor)
53 // UNSPECIFIED-DEF: define void @_ZN1DD2Ev(
54 // UNSPECIFIED-EXP: define dllexport void @_ZN1DD2Ev(
56 // D::~D() (complete object destructor)
57 // UNSPECIFIED-DEF: define void @_ZN1DD1Ev(
58 // UNSPECIFIED-EXP: define dllexport void @_ZN1DD1Ev(
60 // UNSPECIFIED-DEF: define void @_Z4funcv(
61 // UNSPECIFIED-EXP: define dllexport void @_Z4funcv(
63 // B<A>::B(A) (complete object constructor)
64 // UNSPECIFIED-DEF: define linkonce_odr void @_ZN1BI1AEC1ES0_(
65 // UNSPECIFIED-EXP: define linkonce_odr dllexport void @_ZN1BI1AEC1ES0_(
67 // C<A>::C(A) (complete object constructor)
68 // EXPLICIT-DEF: define linkonce_odr void @_ZN1CI1AEC1ES0_(
69 // EXPLICIT-EXP: define linkonce_odr dllexport void @_ZN1CI1AEC1ES0_(
71 // B<A>::func(A)
72 // UNSPECIFIED-DEF: define linkonce_odr void @_ZN1BI1AE4funcES0_(
73 // UNSPECIFIED-EXP: define linkonce_odr dllexport void @_ZN1BI1AE4funcES0_(
75 // C<A>::func(A)
76 // EXPLICIT-DEF: define linkonce_odr void @_ZN1CI1AE4funcES0_(
77 // EXPLICIT-EXP: define linkonce_odr dllexport void @_ZN1CI1AE4funcES0_(
79 // B<int>::B(int) (complete object constructor)
80 // CHECK: declare void @_ZN1BIiEC1Ei
82 // C<int>::C(int) (complete object constructor)
83 // CHECK: declare void @_ZN1CIiEC1Ei
85 // B<int>::func(int)
86 // CHECK: declare void @_ZN1BIiE4funcEi
88 // C<int>::func(int)
89 // CHECK: declare void @_ZN1CIiE4funcEi
91 // C<int>::~C() (complete object destructor)
92 // CHECK: declare void @_ZN1CIiED1Ev
94 // B<int>::~B() (complete object destructor)
95 // CHECK: declare void @_ZN1BIiED1Ev
97 // C<A>::~c() (complete object destructor)
98 // EXPLICIT-DEF: define linkonce_odr void @_ZN1CI1AED1Ev(
99 // EXPLICIT-EXP: define linkonce_odr dllexport void @_ZN1CI1AED1Ev(
101 // B<A>::~B() (complete object destructor)
102 // UNSPECIFIED-DEF: define linkonce_odr void @_ZN1BI1AED1Ev(
103 // UNSPECIFIED-EXP: define linkonce_odr dllexport void @_ZN1BI1AED1Ev(
105 // B<A>::B(A) (base object constructor)
106 // UNSPECIFIED-DEF: define linkonce_odr void @_ZN1BI1AEC2ES0_(
107 // UNSPECIFIED-EXP: define linkonce_odr dllexport void @_ZN1BI1AEC2ES0_(
109 // B<A>::~B() (base object destructor)
110 // UNSPECIFIED-DEF: define linkonce_odr void @_ZN1BI1AED2Ev(
111 // UNSPECIFIED-EXP: define linkonce_odr dllexport void @_ZN1BI1AED2Ev(
113 // C<A>::C(A) (base object constructor)
114 // EXPLICIT-DEF: define linkonce_odr void @_ZN1CI1AEC2ES0_(
115 // EXPLICIT-EXP: define linkonce_odr dllexport void @_ZN1CI1AEC2ES0_(
117 // C<A>::~C() (base object destructor)
118 // EXPLICIT-DEF: define linkonce_odr void @_ZN1CI1AED2Ev(
119 // EXPLICIT-EXP: define linkonce_odr dllexport void @_ZN1CI1AED2Ev(