1 // RUN: %clang_cc1 -emit-llvm %s -o - -triple=i386-pc-win32 | FileCheck %s
2
a1()3 void a1() {}
4 // CHECK: "\01?a1@@YAXXZ"
5
a2()6 int a2() { return 0; }
7 // CHECK: "\01?a2@@YAHXZ"
8
a3()9 const int a3() { return 0; }
10 // CHECK: "\01?a3@@YA?BHXZ"
11
a4()12 volatile int a4() { return 0; }
13 // CHECK: "\01?a4@@YA?CHXZ"
14
a5()15 const volatile int a5() { return 0; }
16 // CHECK: "\01?a5@@YA?DHXZ"
17
a6()18 float a6() { return 0.0f; }
19 // CHECK: "\01?a6@@YAMXZ"
20
b1()21 int *b1() { return 0; }
22 // CHECK: "\01?b1@@YAPAHXZ"
23
b2()24 const char *b2() { return 0; }
25 // CHECK: "\01?b2@@YAPBDXZ"
26
b3()27 float *b3() { return 0; }
28 // CHECK: "\01?b3@@YAPAMXZ"
29
b4()30 const float *b4() { return 0; }
31 // CHECK: "\01?b4@@YAPBMXZ"
32
b5()33 volatile float *b5() { return 0; }
34 // CHECK: "\01?b5@@YAPCMXZ"
35
b6()36 const volatile float *b6() { return 0; }
37 // CHECK: "\01?b6@@YAPDMXZ"
38
b7()39 float &b7() { return *(float*)0; }
40 // CHECK: "\01?b7@@YAAAMXZ"
41
b8()42 const float &b8() { return *(float*)0; }
43 // CHECK: "\01?b8@@YAABMXZ"
44
b9()45 volatile float &b9() { return *(float*)0; }
46 // CHECK: "\01?b9@@YAACMXZ"
47
b10()48 const volatile float &b10() { return *(float*)0; }
49 // CHECK: "\01?b10@@YAADMXZ"
50
b11()51 const char** b11() { return 0; }
52 // CHECK: "\01?b11@@YAPAPBDXZ"
53
54 class A {};
55
c1()56 A c1() { return A(); }
57 // CHECK: "\01?c1@@YA?AVA@@XZ"
58
c2()59 const A c2() { return A(); }
60 // CHECK: "\01?c2@@YA?BVA@@XZ"
61
c3()62 volatile A c3() { return A(); }
63 // CHECK: "\01?c3@@YA?CVA@@XZ"
64
c4()65 const volatile A c4() { return A(); }
66 // CHECK: "\01?c4@@YA?DVA@@XZ"
67
c5()68 const A* c5() { return 0; }
69 // CHECK: "\01?c5@@YAPBVA@@XZ"
70
c6()71 volatile A* c6() { return 0; }
72 // CHECK: "\01?c6@@YAPCVA@@XZ"
73
c7()74 const volatile A* c7() { return 0; }
75 // CHECK: "\01?c7@@YAPDVA@@XZ"
76
c8()77 A &c8() { return *(A*)0; }
78 // CHECK: "\01?c8@@YAAAVA@@XZ"
79
c9()80 const A &c9() { return *(A*)0; }
81 // CHECK: "\01?c9@@YAABVA@@XZ"
82
c10()83 volatile A &c10() { return *(A*)0; }
84 // CHECK: "\01?c10@@YAACVA@@XZ"
85
c11()86 const volatile A &c11() { return *(A*)0; }
87 // CHECK: "\01?c11@@YAADVA@@XZ"
88
89 template<typename T> class B {};
90
d1()91 B<int> d1() { return B<int>(); }
92 // CHECK: "\01?d1@@YA?AV?$B@H@@XZ"
93
d2()94 B<const char*> d2() {return B<const char*>(); }
95 // CHECK: "\01?d2@@YA?AV?$B@PBD@@XZ"
96
d3()97 B<A> d3() {return B<A>(); }
98 // CHECK: "\01?d3@@YA?AV?$B@VA@@@@XZ"
99
d4()100 B<A>* d4() { return 0; }
101 // CHECK: "\01?d4@@YAPAV?$B@VA@@@@XZ"
102
d5()103 const B<A>* d5() { return 0; }
104 // CHECK: "\01?d5@@YAPBV?$B@VA@@@@XZ"
105
d6()106 volatile B<A>* d6() { return 0; }
107 // CHECK: "\01?d6@@YAPCV?$B@VA@@@@XZ"
108
d7()109 const volatile B<A>* d7() { return 0; }
110 // CHECK: "\01?d7@@YAPDV?$B@VA@@@@XZ"
111
d8()112 B<A>& d8() { return *(B<A>*)0; }
113 // CHECK: "\01?d8@@YAAAV?$B@VA@@@@XZ"
114
d9()115 const B<A>& d9() { return *(B<A>*)0; }
116 // CHECK: "\01?d9@@YAABV?$B@VA@@@@XZ"
117
d10()118 volatile B<A>& d10() { return *(B<A>*)0; }
119 // CHECK: "\01?d10@@YAACV?$B@VA@@@@XZ"
120
d11()121 const volatile B<A>& d11() { return *(B<A>*)0; }
122 // CHECK: "\01?d11@@YAADV?$B@VA@@@@XZ"
123
124 enum Enum { DEFAULT };
125
e1()126 Enum e1() { return DEFAULT; }
127 // CHECK: "\01?e1@@YA?AW4Enum@@XZ"
128
e2()129 const Enum e2() { return DEFAULT; }
130 // CHECK: "\01?e2@@YA?BW4Enum@@XZ"
131
e3()132 Enum* e3() { return 0; }
133 // CHECK: "\01?e3@@YAPAW4Enum@@XZ"
134
e4()135 Enum& e4() { return *(Enum*)0; }
136 // CHECK: "\01?e4@@YAAAW4Enum@@XZ"
137
138 struct S {};
139
f1()140 struct S f1() { struct S s; return s; }
141 // CHECK: "\01?f1@@YA?AUS@@XZ"
142
f2()143 const struct S f2() { struct S s; return s; }
144 // CHECK: "\01?f2@@YA?BUS@@XZ"
145
f3()146 struct S* f3() { return 0; }
147 // CHECK: "\01?f3@@YAPAUS@@XZ"
148
f4()149 const struct S* f4() { return 0; }
150 // CHECK: "\01?f4@@YAPBUS@@XZ"
151
f5()152 const volatile struct S* f5() { return 0; }
153 // CHECK: "\01?f5@@YAPDUS@@XZ"
154
f6()155 struct S& f6() { return *(struct S*)0; }
156 // CHECK: "\01?f6@@YAAAUS@@XZ"
157
f7()158 struct S* const f7() { return 0; }
159 // CHECK: "\01?f7@@YAQAUS@@XZ"
160
f8()161 int S::* f8() { return 0; }
162 // CHECK: "\01?f8@@YAPQS@@HXZ"
163
f9()164 int S::* const f9() { return 0; }
165 // CHECK: "\01?f9@@YAQQS@@HXZ"
166
f10()167 int S::* __restrict f10() { return 0; }
168 // CHECK: "\01?f10@@YAPIQS@@HXZ"
169
f11()170 int S::* const __restrict f11() { return 0; }
171 // CHECK: "\01?f11@@YAQIQS@@HXZ"
172
173 typedef int (*function_pointer)(int);
174
g1()175 function_pointer g1() { return 0; }
176 // CHECK: "\01?g1@@YAP6AHH@ZXZ"
177
g2()178 const function_pointer g2() { return 0; }
179 // CHECK: "\01?g2@@YAQ6AHH@ZXZ"
180
g3()181 function_pointer* g3() { return 0; }
182 // CHECK: "\01?g3@@YAPAP6AHH@ZXZ"
183
g4()184 const function_pointer* g4() { return 0; }
185 // CHECK: "\01?g4@@YAPBQ6AHH@ZXZ"
186