1; These tests are based on clang/test/CodeGenCXX/mangle-ms.cpp
2; RUN: llvm-undname < %s | FileCheck %s
3
4; CHECK-NOT: Invalid mangled name
5
6?a@@3HA
7; CHECK: int a
8
9?b@N@@3HA
10; CHECK: int N::b
11
12?anonymous@?A@N@@3HA
13; CHECK: int N::`anonymous namespace'::anonymous
14
15; FIXME: Reference Temporaries
16; ?$RT1@NeedsReferenceTemporary@@3ABHB
17; ?$RT1@NeedsReferenceTemporary@@3AEBHEB
18
19?_c@@YAHXZ
20; CHECK: int __cdecl _c(void)
21
22?d@foo@@0FB
23; CHECK: static short const foo::d
24
25?e@foo@@1JC
26; CHECK: static long volatile foo::e
27
28?f@foo@@2DD
29; CHECK: static char const volatile foo::f
30
31??0foo@@QAE@XZ
32; CHECK: __thiscall foo::foo(void)
33
34??0foo@@QEAA@XZ
35; CHECK: __cdecl foo::foo(void)
36
37??1foo@@QAE@XZ
38; CHECK: __thiscall foo::~foo(void)
39
40??1foo@@QEAA@XZ
41; CHECK: __cdecl foo::~foo(void)
42
43??0foo@@QAE@H@Z
44; CHECK: __thiscall foo::foo(int)
45
46??0foo@@QEAA@H@Z
47; CHECK: __cdecl foo::foo(int)
48
49??0foo@@QAE@PAD@Z
50; CHECK: __thiscall foo::foo(char *)
51
52??0foo@@QEAA@PEAD@Z
53; CHECK: __cdecl foo::foo(char *)
54
55?bar@@YA?AVfoo@@XZ
56; CHECK: class foo __cdecl bar(void)
57
58?bar@@YA?AVfoo@@XZ
59; CHECK: class foo __cdecl bar(void)
60
61??Hfoo@@QAEHH@Z
62; CHECK: int __thiscall foo::operator+(int)
63
64??Hfoo@@QEAAHH@Z
65; CHECK: int __cdecl foo::operator+(int)
66
67?static_method@foo@@SAPAV1@XZ
68; CHECK: static class foo * __cdecl foo::static_method(void)
69
70?static_method@foo@@SAPEAV1@XZ
71; CHECK: static class foo * __cdecl foo::static_method(void)
72
73?g@bar@@2HA
74; CHECK: static int bar::g
75
76; undname returns `int *h1`, but it is a bug in their demangler.  Their mangler
77; correctly mangles `int *h1` as ?h1@3PAHA and `int * const h1` as ?h1@3QAHA
78?h1@@3QAHA
79; CHECK: int *const h1
80
81?h2@@3QBHB
82; CHECK: int const *const h2
83
84?h3@@3QIAHIA
85; CHECK: int *const __restrict h3
86
87?h3@@3QEIAHEIA
88; CHECK: int *const __restrict h3
89
90?i@@3PAY0BE@HA
91; CHECK: int (*i)[20]
92
93?FunArr@@3PAY0BE@P6AHHH@ZA
94; CHECK: int (__cdecl *(*FunArr)[20])(int, int)
95
96?j@@3P6GHCE@ZA
97; CHECK: int (__stdcall *j)(signed char, unsigned char)
98
99?funptr@@YAP6AHXZXZ
100; CHECK: int (__cdecl * __cdecl funptr(void))(void)
101
102?k@@3PTfoo@@DT1@
103; CHECK: char const volatile foo::*k
104
105?k@@3PETfoo@@DET1@
106; CHECK: char const volatile foo::*k
107
108?l@@3P8foo@@AEHH@ZQ1@
109; CHECK: int (__thiscall foo::*l)(int)
110
111?g_cInt@@3HB
112; CHECK: int const g_cInt
113
114?g_vInt@@3HC
115; CHECK: int volatile g_vInt
116
117?g_cvInt@@3HD
118; CHECK: int const volatile g_cvInt
119
120?beta@@YI_N_J_W@Z
121; CHECK: bool __fastcall beta(__int64, wchar_t)
122
123?beta@@YA_N_J_W@Z
124; CHECK: bool __cdecl beta(__int64, wchar_t)
125
126?alpha@@YGXMN@Z
127; CHECK: void __stdcall alpha(float, double)
128
129?alpha@@YAXMN@Z
130; CHECK: void __cdecl alpha(float, double)
131
132?gamma@@YAXVfoo@@Ubar@@Tbaz@@W4quux@@@Z
133; CHECK: void __cdecl gamma(class foo, struct bar, union baz, enum quux)
134
135?gamma@@YAXVfoo@@Ubar@@Tbaz@@W4quux@@@Z
136; CHECK: void __cdecl gamma(class foo, struct bar, union baz, enum quux)
137
138?delta@@YAXQAHABJ@Z
139; CHECK: void __cdecl delta(int *const, long const &)
140
141?delta@@YAXQEAHAEBJ@Z
142; CHECK: void __cdecl delta(int *const, long const &)
143
144?epsilon@@YAXQAY19BE@H@Z
145; CHECK: void __cdecl epsilon(int (*const)[10][20])
146
147?epsilon@@YAXQEAY19BE@H@Z
148; CHECK: void __cdecl epsilon(int (*const)[10][20])
149
150?zeta@@YAXP6AHHH@Z@Z
151; CHECK: void __cdecl zeta(int (__cdecl *)(int, int))
152
153?zeta@@YAXP6AHHH@Z@Z
154; CHECK: void __cdecl zeta(int (__cdecl *)(int, int))
155
156; FIXME: We don't support blocks yet.
157
158; ?eta@@YAXP_EAHHH@Z@Z
159; FIXME: void eta(int (^)(int, int))
160; ?theta@@YAXP_EAHHH@Z@Z
161; FIXME: void theta(int(int,int)^ block)
162
163??2@YAPAXI@Z
164; CHECK: void * __cdecl operator new(unsigned int)
165
166??3@YAXPAX@Z
167; CHECK: void __cdecl operator delete(void *)
168
169??_U@YAPAXI@Z
170; CHECK: void * __cdecl operator new[](unsigned int)
171
172??_V@YAXPAX@Z
173; CHECK: void __cdecl operator delete[](void *)
174
175?color1@@3PANA
176; CHECK: double *color1
177
178?color2@@3QBNB
179; CHECK: double const *const color2
180
181; FIXME-EXTRACONST: These tests fails because we print an extra const inside the parens.
182; ?color3@@3QAY02$$CBNA
183; FIXME-EXTRACONST: double const (*color3)[3]
184
185; ?color4@@3QAY02$$CBNA
186; FIXME-EXTRACONST: double const (*color4)[3]
187
188?memptr1@@3RESB@@HES1@
189; CHECK: int volatile B::*volatile memptr1
190
191?memptr2@@3PESB@@HES1@
192; CHECK: int volatile B::*memptr2
193
194?memptr3@@3REQB@@HEQ1@
195; CHECK: int B::*volatile memptr3
196
197?funmemptr1@@3RESB@@R6AHXZES1@
198; CHECK: int (__cdecl *volatile B::*volatile funmemptr1)(void)
199
200?funmemptr2@@3PESB@@R6AHXZES1@
201; CHECK: int (__cdecl *volatile B::*funmemptr2)(void)
202
203?funmemptr3@@3REQB@@P6AHXZEQ1@
204; CHECK: int (__cdecl *B::*volatile funmemptr3)(void)
205
206?memptrtofun1@@3R8B@@EAAXXZEQ1@
207; CHECK: void (__cdecl B::*volatile memptrtofun1)(void)
208
209?memptrtofun2@@3P8B@@EAAXXZEQ1@
210; CHECK: void (__cdecl B::*memptrtofun2)(void)
211
212?memptrtofun3@@3P8B@@EAAXXZEQ1@
213; CHECK: void (__cdecl B::*memptrtofun3)(void)
214
215?memptrtofun4@@3R8B@@EAAHXZEQ1@
216; CHECK: int (__cdecl B::*volatile memptrtofun4)(void)
217
218?memptrtofun5@@3P8B@@EAA?CHXZEQ1@
219; CHECK: int volatile (__cdecl B::*memptrtofun5)(void)
220
221?memptrtofun6@@3P8B@@EAA?BHXZEQ1@
222; CHECK: int const (__cdecl B::*memptrtofun6)(void)
223
224?memptrtofun7@@3R8B@@EAAP6AHXZXZEQ1@
225; CHECK: int (__cdecl * (__cdecl B::*volatile memptrtofun7)(void))(void)
226
227?memptrtofun8@@3P8B@@EAAR6AHXZXZEQ1@
228; CHECK: int (__cdecl *volatile (__cdecl B::*memptrtofun8)(void))(void)
229
230?memptrtofun9@@3P8B@@EAAQ6AHXZXZEQ1@
231; CHECK: int (__cdecl *const (__cdecl B::*memptrtofun9)(void))(void)
232
233
234?fooE@@YA?AW4E@@XZ
235; CHECK: enum E __cdecl fooE(void)
236
237?fooE@@YA?AW4E@@XZ
238; CHECK: enum E __cdecl fooE(void)
239
240?fooX@@YA?AVX@@XZ
241; CHECK: class X __cdecl fooX(void)
242
243?fooX@@YA?AVX@@XZ
244; CHECK: class X __cdecl fooX(void)
245
246?s0@PR13182@@3PADA
247; CHECK: char *PR13182::s0
248
249?s1@PR13182@@3PADA
250; CHECK: char *PR13182::s1
251
252?s2@PR13182@@3QBDB
253; CHECK: char const *const PR13182::s2
254
255?s3@PR13182@@3QBDB
256; CHECK: char const *const PR13182::s3
257
258?s4@PR13182@@3RCDC
259; CHECK: char volatile *volatile PR13182::s4
260
261?s5@PR13182@@3SDDD
262; CHECK: char const volatile *const volatile PR13182::s5
263
264; undname adds an extra const in here, but it seems like their bug.
265?s6@PR13182@@3PBQBDB
266; CHECK: char const *const *PR13182::s6
267
268; FIXME: We don't properly support extern "C" functions yet.
269; ?local@?1??extern_c_func@@9@4HA
270; FIXME: int `extern_c_func'::`2'::local
271
272; ?local@?1??extern_c_func@@9@4HA
273; FIXME: int `extern_c_func'::`2'::local
274
275?v@?1??f@@YAHXZ@4U<unnamed-type-v>@?1??1@YAHXZ@A
276; CHECK: struct `int __cdecl f(void)'::`2'::<unnamed-type-v> `int __cdecl f(void)'::`2'::v
277
278?v@?1???$f@H@@YAHXZ@4U<unnamed-type-v>@?1???$f@H@@YAHXZ@A
279; CHECK: struct `int __cdecl f<int>(void)'::`2'::<unnamed-type-v> `int __cdecl f<int>(void)'::`2'::v
280
281??2OverloadedNewDelete@@SAPAXI@Z
282; CHECK: static void * __cdecl OverloadedNewDelete::operator new(unsigned int)
283
284
285??_UOverloadedNewDelete@@SAPAXI@Z
286; CHECK: static void * __cdecl OverloadedNewDelete::operator new[](unsigned int)
287
288??3OverloadedNewDelete@@SAXPAX@Z
289; CHECK: static void __cdecl OverloadedNewDelete::operator delete(void *)
290
291
292??_VOverloadedNewDelete@@SAXPAX@Z
293; CHECK: static void __cdecl OverloadedNewDelete::operator delete[](void *)
294
295??HOverloadedNewDelete@@QAEHH@Z
296; CHECK: int __thiscall OverloadedNewDelete::operator+(int)
297
298??2OverloadedNewDelete@@SAPEAX_K@Z
299; CHECK: static void * __cdecl OverloadedNewDelete::operator new(unsigned __int64)
300
301??_UOverloadedNewDelete@@SAPEAX_K@Z
302; CHECK: static void * __cdecl OverloadedNewDelete::operator new[](unsigned __int64)
303
304??3OverloadedNewDelete@@SAXPEAX@Z
305; CHECK: static void __cdecl OverloadedNewDelete::operator delete(void *)
306
307
308??_VOverloadedNewDelete@@SAXPEAX@Z
309; CHECK: static void __cdecl OverloadedNewDelete::operator delete[](void *)
310
311??HOverloadedNewDelete@@QEAAHH@Z
312; CHECK: int __cdecl OverloadedNewDelete::operator+(int)
313
314
315??2TypedefNewDelete@@SAPAXI@Z
316; CHECK: static void * __cdecl TypedefNewDelete::operator new(unsigned int)
317
318
319??_UTypedefNewDelete@@SAPAXI@Z
320; CHECK: static void * __cdecl TypedefNewDelete::operator new[](unsigned int)
321
322??3TypedefNewDelete@@SAXPAX@Z
323; CHECK: static void __cdecl TypedefNewDelete::operator delete(void *)
324
325??_VTypedefNewDelete@@SAXPAX@Z
326; CHECK: static void __cdecl TypedefNewDelete::operator delete[](void *)
327
328?vector_func@@YQXXZ
329; CHECK: void __vectorcall vector_func(void)
330
331; FIXME: We don't support extern C funcs currently.
332; ??$fn_tmpl@$1?extern_c_func@@YAXXZ@@YAXXZ
333; FIXME: void __cdecl fn_tmpl<&void __cdecl extern_c_func(void)>(void)
334
335; ?overloaded_fn@@$$J0YAXXZ
336; FIXME-EXTERNC: extern \"C\" void __cdecl overloaded_fn(void)
337
338?f@UnnamedType@@YAXQAPAU<unnamed-type-T1>@S@1@@Z
339; CHECK: void __cdecl UnnamedType::f(struct UnnamedType::S::<unnamed-type-T1> **const)
340
341?f@UnnamedType@@YAXUT2@S@1@@Z
342; CHECK: void __cdecl UnnamedType::f(struct UnnamedType::S::T2)
343
344?f@UnnamedType@@YAXPAUT4@S@1@@Z
345; CHECK: void __cdecl UnnamedType::f(struct UnnamedType::S::T4 *)
346
347?f@UnnamedType@@YAXUT4@S@1@@Z
348; CHECK: void __cdecl UnnamedType::f(struct UnnamedType::S::T4)
349
350?f@UnnamedType@@YAXUT5@S@1@@Z
351; CHECK: void __cdecl UnnamedType::f(struct UnnamedType::S::T5)
352
353?f@UnnamedType@@YAXUT2@S@1@@Z
354; CHECK: void __cdecl UnnamedType::f(struct UnnamedType::S::T2)
355
356?f@UnnamedType@@YAXUT4@S@1@@Z
357; CHECK: void __cdecl UnnamedType::f(struct UnnamedType::S::T4)
358
359?f@UnnamedType@@YAXUT5@S@1@@Z
360; CHECK: void __cdecl UnnamedType::f(struct UnnamedType::S::T5)
361
362
363; ?foo@PassObjectSize@@YAHQAHW4__pass_object_size0@__clang@@@Z
364; FIXME: int foo(int *const i __attribute__((pass_object_size(0))));
365; ?bar@PassObjectSize@@YAHQAHW4__pass_object_size1@__clang@@@Z
366; FIXME: int bar(int *const i __attribute__((pass_object_size(1))));
367; ?qux@PassObjectSize@@YAHQAHW4__pass_object_size1@__clang@@0W4__pass_object_size0@3@@Z
368; FIXME: int qux(int *const i __attribute__((pass_object_size(1))), int *const j __attribute__((pass_object_size(0))));
369; ?zot@PassObjectSize@@YAHQAHW4__pass_object_size1@__clang@@01@Z
370; FIXME: int zot(int *const i __attribute__((pass_object_size(1))), int *const j __attribute__((pass_object_size(1))));
371
372
373
374?f@Atomic@@YAXU?$_Atomic@H@__clang@@@Z
375; CHECK: void __cdecl Atomic::f(struct __clang::_Atomic<int>)
376
377?f@Complex@@YAXU?$_Complex@H@__clang@@@Z
378; CHECK: void __cdecl Complex::f(struct __clang::_Complex<int>)
379
380?f@Float16@@YAXU_Float16@__clang@@@Z
381; CHECK: void __cdecl Float16::f(struct __clang::_Float16)
382
383
384??0?$L@H@NS@@QEAA@XZ
385; CHECK: __cdecl NS::L<int>::L<int>(void)
386
387??0Bar@Foo@@QEAA@XZ
388; CHECK: __cdecl Foo::Bar::Bar(void)
389
390??0?$L@V?$H@PAH@PR26029@@@PR26029@@QAE@XZ
391; CHECK: __thiscall PR26029::L<class PR26029::H<int *>>::L<class PR26029::H<int *>>(void)
392