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