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