1 ; These tests are based on clang/test/CodeGenCXX/mangle-ms.cpp
2 ; RUN: llvm-undname < %s | FileCheck %s
4 ; CHECK-NOT: Invalid mangled name
13 ; CHECK: int N::`anonymous namespace'::anonymous
15 ?$RT1@NeedsReferenceTemporary@@3ABHB
16 ; CHECK: int const &NeedsReferenceTemporary::$RT1
17 ?$RT1@NeedsReferenceTemporary@@3AEBHEB
18 ; CHECK: int const &NeedsReferenceTemporary::$RT1
21 ; CHECK: int __cdecl _c(void)
24 ; CHECK: static short const foo::d
27 ; CHECK: static long volatile foo::e
30 ; CHECK: static char const volatile foo::f
33 ; CHECK: __thiscall foo::foo(void)
36 ; CHECK: __cdecl foo::foo(void)
39 ; CHECK: __thiscall foo::~foo(void)
42 ; CHECK: __cdecl foo::~foo(void)
45 ; CHECK: __thiscall foo::foo(int)
48 ; CHECK: __cdecl foo::foo(int)
51 ; CHECK: __thiscall foo::foo(char *)
54 ; CHECK: __cdecl foo::foo(char *)
57 ; CHECK: class foo __cdecl bar(void)
60 ; CHECK: class foo __cdecl bar(void)
63 ; CHECK: int __thiscall foo::operator+(int)
66 ; CHECK: int __cdecl foo::operator+(int)
69 ; CHECK: double & __cdecl S::operator+<int>(int)
71 ?static_method@foo@@SAPAV1@XZ
72 ; CHECK: static class foo * __cdecl foo::static_method(void)
74 ?static_method@foo@@SAPEAV1@XZ
75 ; CHECK: static class foo * __cdecl foo::static_method(void)
78 ; CHECK: static int bar::g
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
83 ; CHECK: int *const h1
86 ; CHECK: int const *const h2
89 ; CHECK: int *const __restrict h3
92 ; CHECK: int *const __restrict h3
97 ?FunArr@@3PAY0BE@P6AHHH@ZA
98 ; CHECK: int (__cdecl *(*FunArr)[20])(int, int)
101 ; CHECK: int (__stdcall *j)(signed char, unsigned char)
104 ; CHECK: int (__cdecl * __cdecl funptr(void))(void)
107 ; CHECK: char const foo::*m
110 ; CHECK: char const foo::*m
113 ; CHECK: char const volatile foo::*k
116 ; CHECK: char const volatile foo::*k
118 ?l@@3P8foo@@AEHH@ZQ1@
119 ; CHECK: int (__thiscall foo::*l)(int)
122 ; CHECK: int const g_cInt
125 ; CHECK: int volatile g_vInt
128 ; CHECK: int const volatile g_cvInt
131 ; CHECK: bool __fastcall beta(__int64, wchar_t)
134 ; CHECK: bool __cdecl beta(__int64, wchar_t)
137 ; CHECK: void __stdcall alpha(float, double)
140 ; CHECK: void __cdecl alpha(float, double)
142 ?gamma@@YAXVfoo@@Ubar@@Tbaz@@W4quux@@@Z
143 ; CHECK: void __cdecl gamma(class foo, struct bar, union baz, enum quux)
145 ?gamma@@YAXVfoo@@Ubar@@Tbaz@@W4quux@@@Z
146 ; CHECK: void __cdecl gamma(class foo, struct bar, union baz, enum quux)
149 ; CHECK: void __cdecl delta(int *const, long const &)
151 ?delta@@YAXQEAHAEBJ@Z
152 ; CHECK: void __cdecl delta(int *const, long const &)
154 ?epsilon@@YAXQAY19BE@H@Z
155 ; CHECK: void __cdecl epsilon(int (*const)[10][20])
157 ?epsilon@@YAXQEAY19BE@H@Z
158 ; CHECK: void __cdecl epsilon(int (*const)[10][20])
161 ; CHECK: void __cdecl zeta(int (__cdecl *)(int, int))
164 ; CHECK: void __cdecl zeta(int (__cdecl *)(int, int))
166 ; FIXME: We don't support blocks yet.
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)
174 ; CHECK: void * __cdecl operator new(unsigned int)
177 ; CHECK: void __cdecl operator delete(void *)
180 ; CHECK: void * __cdecl operator new[](unsigned int)
183 ; CHECK: void __cdecl operator delete[](void *)
186 ; CHECK: double *color1
189 ; CHECK: double const *const color2
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]
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]
199 ?memptr1@@3RESB@@HES1@
200 ; CHECK: int volatile B::*volatile memptr1
202 ?memptr2@@3PESB@@HES1@
203 ; CHECK: int volatile B::*memptr2
205 ?memptr3@@3REQB@@HEQ1@
206 ; CHECK: int B::*volatile memptr3
208 ?funmemptr1@@3RESB@@R6AHXZES1@
209 ; CHECK: int (__cdecl *volatile B::*volatile funmemptr1)(void)
211 ?funmemptr2@@3PESB@@R6AHXZES1@
212 ; CHECK: int (__cdecl *volatile B::*funmemptr2)(void)
214 ?funmemptr3@@3REQB@@P6AHXZEQ1@
215 ; CHECK: int (__cdecl *B::*volatile funmemptr3)(void)
217 ?memptrtofun1@@3R8B@@EAAXXZEQ1@
218 ; CHECK: void (__cdecl B::*volatile memptrtofun1)(void)
220 ?memptrtofun2@@3P8B@@EAAXXZEQ1@
221 ; CHECK: void (__cdecl B::*memptrtofun2)(void)
223 ?memptrtofun3@@3P8B@@EAAXXZEQ1@
224 ; CHECK: void (__cdecl B::*memptrtofun3)(void)
226 ?memptrtofun4@@3R8B@@EAAHXZEQ1@
227 ; CHECK: int (__cdecl B::*volatile memptrtofun4)(void)
229 ?memptrtofun5@@3P8B@@EAA?CHXZEQ1@
230 ; CHECK: int volatile (__cdecl B::*memptrtofun5)(void)
232 ?memptrtofun6@@3P8B@@EAA?BHXZEQ1@
233 ; CHECK: int const (__cdecl B::*memptrtofun6)(void)
235 ?memptrtofun7@@3R8B@@EAAP6AHXZXZEQ1@
236 ; CHECK: int (__cdecl * (__cdecl B::*volatile memptrtofun7)(void))(void)
238 ?memptrtofun8@@3P8B@@EAAR6AHXZXZEQ1@
239 ; CHECK: int (__cdecl *volatile (__cdecl B::*memptrtofun8)(void))(void)
241 ?memptrtofun9@@3P8B@@EAAQ6AHXZXZEQ1@
242 ; CHECK: int (__cdecl *const (__cdecl B::*memptrtofun9)(void))(void)
246 ; CHECK: enum E __cdecl fooE(void)
249 ; CHECK: enum E __cdecl fooE(void)
252 ; CHECK: class X __cdecl fooX(void)
255 ; CHECK: class X __cdecl fooX(void)
258 ; CHECK: char *PR13182::s0
261 ; CHECK: char *PR13182::s1
264 ; CHECK: char const *const PR13182::s2
267 ; CHECK: char const *const PR13182::s3
270 ; CHECK: char volatile *volatile PR13182::s4
273 ; CHECK: char const volatile *const volatile PR13182::s5
275 ; undname adds an extra const in here, but it seems like their bug.
277 ; CHECK: char const *const *PR13182::s6
279 ?local@?1??extern_c_func@@9@4HA
280 ; CHECK: int `extern "C" extern_c_func'::`2'::local
282 ?local@?1??extern_c_func@@9@4HA
283 ; CHECK: int `extern "C" extern_c_func'::`2'::local
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
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
291 ??2OverloadedNewDelete@@SAPAXI@Z
292 ; CHECK: static void * __cdecl OverloadedNewDelete::operator new(unsigned int)
295 ??_UOverloadedNewDelete@@SAPAXI@Z
296 ; CHECK: static void * __cdecl OverloadedNewDelete::operator new[](unsigned int)
298 ??3OverloadedNewDelete@@SAXPAX@Z
299 ; CHECK: static void __cdecl OverloadedNewDelete::operator delete(void *)
302 ??_VOverloadedNewDelete@@SAXPAX@Z
303 ; CHECK: static void __cdecl OverloadedNewDelete::operator delete[](void *)
305 ??HOverloadedNewDelete@@QAEHH@Z
306 ; CHECK: int __thiscall OverloadedNewDelete::operator+(int)
308 ??2OverloadedNewDelete@@SAPEAX_K@Z
309 ; CHECK: static void * __cdecl OverloadedNewDelete::operator new(unsigned __int64)
311 ??_UOverloadedNewDelete@@SAPEAX_K@Z
312 ; CHECK: static void * __cdecl OverloadedNewDelete::operator new[](unsigned __int64)
314 ??3OverloadedNewDelete@@SAXPEAX@Z
315 ; CHECK: static void __cdecl OverloadedNewDelete::operator delete(void *)
318 ??_VOverloadedNewDelete@@SAXPEAX@Z
319 ; CHECK: static void __cdecl OverloadedNewDelete::operator delete[](void *)
321 ??HOverloadedNewDelete@@QEAAHH@Z
322 ; CHECK: int __cdecl OverloadedNewDelete::operator+(int)
325 ??2TypedefNewDelete@@SAPAXI@Z
326 ; CHECK: static void * __cdecl TypedefNewDelete::operator new(unsigned int)
329 ??_UTypedefNewDelete@@SAPAXI@Z
330 ; CHECK: static void * __cdecl TypedefNewDelete::operator new[](unsigned int)
332 ??3TypedefNewDelete@@SAXPAX@Z
333 ; CHECK: static void __cdecl TypedefNewDelete::operator delete(void *)
335 ??_VTypedefNewDelete@@SAXPAX@Z
336 ; CHECK: static void __cdecl TypedefNewDelete::operator delete[](void *)
339 ; CHECK: void __vectorcall vector_func(void)
342 ; CHECK: void __attribute__((__swiftcall__)) swift_func(void)
344 ?swift_async_func@@YWXXZ
345 ; CHECK: void __attribute__((__swiftasynccall__)) swift_async_func(void)
347 ??$fn_tmpl@$1?extern_c_func@@YAXXZ@@YAXXZ
348 ; CHECK: void __cdecl fn_tmpl<&void __cdecl extern_c_func(void)>(void)
350 ?overloaded_fn@@$$J0YAXXZ
351 ; CHECK: extern "C" void __cdecl overloaded_fn(void)
353 ?f@UnnamedType@@YAXQAPAU<unnamed-type-T1>@S@1@@Z
354 ; CHECK: void __cdecl UnnamedType::f(struct UnnamedType::S::<unnamed-type-T1> **const)
356 ?f@UnnamedType@@YAXUT2@S@1@@Z
357 ; CHECK: void __cdecl UnnamedType::f(struct UnnamedType::S::T2)
359 ?f@UnnamedType@@YAXPAUT4@S@1@@Z
360 ; CHECK: void __cdecl UnnamedType::f(struct UnnamedType::S::T4 *)
362 ?f@UnnamedType@@YAXUT4@S@1@@Z
363 ; CHECK: void __cdecl UnnamedType::f(struct UnnamedType::S::T4)
365 ?f@UnnamedType@@YAXUT5@S@1@@Z
366 ; CHECK: void __cdecl UnnamedType::f(struct UnnamedType::S::T5)
368 ?f@UnnamedType@@YAXUT2@S@1@@Z
369 ; CHECK: void __cdecl UnnamedType::f(struct UnnamedType::S::T2)
371 ?f@UnnamedType@@YAXUT4@S@1@@Z
372 ; CHECK: void __cdecl UnnamedType::f(struct UnnamedType::S::T4)
374 ?f@UnnamedType@@YAXUT5@S@1@@Z
375 ; CHECK: void __cdecl UnnamedType::f(struct UnnamedType::S::T5)
378 ; ?foo@PassObjectSize@@YAHQAHW4__pass_object_size0@__clang@@@Z
379 ; FIXME: int foo(int *const i __attribute__((pass_object_size(0))));
380 ; ?bar@PassObjectSize@@YAHQAHW4__pass_object_size1@__clang@@@Z
381 ; FIXME: int bar(int *const i __attribute__((pass_object_size(1))));
382 ; ?qux@PassObjectSize@@YAHQAHW4__pass_object_size1@__clang@@0W4__pass_object_size0@3@@Z
383 ; FIXME: int qux(int *const i __attribute__((pass_object_size(1))), int *const j __attribute__((pass_object_size(0))));
384 ; ?zot@PassObjectSize@@YAHQAHW4__pass_object_size1@__clang@@01@Z
385 ; FIXME: int zot(int *const i __attribute__((pass_object_size(1))), int *const j __attribute__((pass_object_size(1))));
389 ?f@Atomic@@YAXU?$_Atomic@H@__clang@@@Z
390 ; CHECK: void __cdecl Atomic::f(struct __clang::_Atomic<int>)
392 ?f@Complex@@YAXU?$_Complex@H@__clang@@@Z
393 ; CHECK: void __cdecl Complex::f(struct __clang::_Complex<int>)
395 ?f@Float16@@YAXU_Float16@__clang@@@Z
396 ; CHECK: void __cdecl Float16::f(struct __clang::_Float16)
400 ; CHECK: __cdecl NS::L<int>::L<int>(void)
403 ; CHECK: __cdecl Foo::Bar::Bar(void)
405 ??0?$L@V?$H@PAH@PR26029@@@PR26029@@QAE@XZ
406 ; CHECK: __thiscall PR26029::L<class PR26029::H<int *>>::L<class PR26029::H<int *>>(void)
408 ??$emplace_back@ABH@?$vector@HV?$allocator@H@std@@@std@@QAE?A?<decltype-auto>@@ABH@Z
409 ; CHECK: <decltype-auto> __thiscall std::vector<int, class std::allocator<int>>::emplace_back<int const &>(int const &)
413 ; CHECK: public: void __thiscall S::pub_foo(void)
415 ?pub_stat_foo@S@@SAXXZ
416 ; CHECK: public: static void __cdecl S::pub_stat_foo(void)
418 ?pub_virt_foo@S@@UAEXXZ
419 ; CHECK: public: virtual void __thiscall S::pub_virt_foo(void)
422 ; CHECK: protected: void __thiscall S::prot_foo(void)
424 ?prot_stat_foo@S@@KAXXZ
425 ; CHECK: protected: static void __cdecl S::prot_stat_foo(void)
427 ?prot_virt_foo@S@@MAEXXZ
428 ; CHECK: protected: virtual void __thiscall S::prot_virt_foo(void)
431 ; CHECK: private: void __thiscall S::priv_foo(void)
433 ?priv_stat_foo@S@@CAXXZ
434 ; CHECK: private: static void __cdecl S::priv_stat_foo(void)
436 ?priv_virt_foo@S@@EAEXXZ
437 ; CHECK: private: virtual void __thiscall S::priv_virt_foo(void)