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 volatile foo::*k
110 ; CHECK: char const volatile foo::*k
112 ?l@@3P8foo@@AEHH@ZQ1@
113 ; CHECK: int (__thiscall foo::*l)(int)
116 ; CHECK: int const g_cInt
119 ; CHECK: int volatile g_vInt
122 ; CHECK: int const volatile g_cvInt
125 ; CHECK: bool __fastcall beta(__int64, wchar_t)
128 ; CHECK: bool __cdecl beta(__int64, wchar_t)
131 ; CHECK: void __stdcall alpha(float, double)
134 ; CHECK: void __cdecl alpha(float, double)
136 ?gamma@@YAXVfoo@@Ubar@@Tbaz@@W4quux@@@Z
137 ; CHECK: void __cdecl gamma(class foo, struct bar, union baz, enum quux)
139 ?gamma@@YAXVfoo@@Ubar@@Tbaz@@W4quux@@@Z
140 ; CHECK: void __cdecl gamma(class foo, struct bar, union baz, enum quux)
143 ; CHECK: void __cdecl delta(int *const, long const &)
145 ?delta@@YAXQEAHAEBJ@Z
146 ; CHECK: void __cdecl delta(int *const, long const &)
148 ?epsilon@@YAXQAY19BE@H@Z
149 ; CHECK: void __cdecl epsilon(int (*const)[10][20])
151 ?epsilon@@YAXQEAY19BE@H@Z
152 ; CHECK: void __cdecl epsilon(int (*const)[10][20])
155 ; CHECK: void __cdecl zeta(int (__cdecl *)(int, int))
158 ; CHECK: void __cdecl zeta(int (__cdecl *)(int, int))
160 ; FIXME: We don't support blocks yet.
162 ; ?eta@@YAXP_EAHHH@Z@Z
163 ; FIXME: void eta(int (^)(int, int))
164 ; ?theta@@YAXP_EAHHH@Z@Z
165 ; FIXME: void theta(int(int,int)^ block)
168 ; CHECK: void * __cdecl operator new(unsigned int)
171 ; CHECK: void __cdecl operator delete(void *)
174 ; CHECK: void * __cdecl operator new[](unsigned int)
177 ; CHECK: void __cdecl operator delete[](void *)
180 ; CHECK: double *color1
183 ; CHECK: double const *const color2
185 ; undname prints `double const (* color3)[3]`, but this is a bug in undname.
186 ?color3@@3QAY02$$CBNA
187 ; CHECK: double const (*const color3)[3]
189 ; undname prints `double const (* color4)[3]`, but this is a bug in undname.
190 ?color4@@3QAY02$$CBNA
191 ; CHECK: double const (*const color4)[3]
193 ?memptr1@@3RESB@@HES1@
194 ; CHECK: int volatile B::*volatile memptr1
196 ?memptr2@@3PESB@@HES1@
197 ; CHECK: int volatile B::*memptr2
199 ?memptr3@@3REQB@@HEQ1@
200 ; CHECK: int B::*volatile memptr3
202 ?funmemptr1@@3RESB@@R6AHXZES1@
203 ; CHECK: int (__cdecl *volatile B::*volatile funmemptr1)(void)
205 ?funmemptr2@@3PESB@@R6AHXZES1@
206 ; CHECK: int (__cdecl *volatile B::*funmemptr2)(void)
208 ?funmemptr3@@3REQB@@P6AHXZEQ1@
209 ; CHECK: int (__cdecl *B::*volatile funmemptr3)(void)
211 ?memptrtofun1@@3R8B@@EAAXXZEQ1@
212 ; CHECK: void (__cdecl B::*volatile memptrtofun1)(void)
214 ?memptrtofun2@@3P8B@@EAAXXZEQ1@
215 ; CHECK: void (__cdecl B::*memptrtofun2)(void)
217 ?memptrtofun3@@3P8B@@EAAXXZEQ1@
218 ; CHECK: void (__cdecl B::*memptrtofun3)(void)
220 ?memptrtofun4@@3R8B@@EAAHXZEQ1@
221 ; CHECK: int (__cdecl B::*volatile memptrtofun4)(void)
223 ?memptrtofun5@@3P8B@@EAA?CHXZEQ1@
224 ; CHECK: int volatile (__cdecl B::*memptrtofun5)(void)
226 ?memptrtofun6@@3P8B@@EAA?BHXZEQ1@
227 ; CHECK: int const (__cdecl B::*memptrtofun6)(void)
229 ?memptrtofun7@@3R8B@@EAAP6AHXZXZEQ1@
230 ; CHECK: int (__cdecl * (__cdecl B::*volatile memptrtofun7)(void))(void)
232 ?memptrtofun8@@3P8B@@EAAR6AHXZXZEQ1@
233 ; CHECK: int (__cdecl *volatile (__cdecl B::*memptrtofun8)(void))(void)
235 ?memptrtofun9@@3P8B@@EAAQ6AHXZXZEQ1@
236 ; CHECK: int (__cdecl *const (__cdecl B::*memptrtofun9)(void))(void)
240 ; CHECK: enum E __cdecl fooE(void)
243 ; CHECK: enum E __cdecl fooE(void)
246 ; CHECK: class X __cdecl fooX(void)
249 ; CHECK: class X __cdecl fooX(void)
252 ; CHECK: char *PR13182::s0
255 ; CHECK: char *PR13182::s1
258 ; CHECK: char const *const PR13182::s2
261 ; CHECK: char const *const PR13182::s3
264 ; CHECK: char volatile *volatile PR13182::s4
267 ; CHECK: char const volatile *const volatile PR13182::s5
269 ; undname adds an extra const in here, but it seems like their bug.
271 ; CHECK: char const *const *PR13182::s6
273 ?local@?1??extern_c_func@@9@4HA
274 ; CHECK: int `extern "C" extern_c_func'::`2'::local
276 ?local@?1??extern_c_func@@9@4HA
277 ; CHECK: int `extern "C" extern_c_func'::`2'::local
279 ?v@?1??f@@YAHXZ@4U<unnamed-type-v>@?1??1@YAHXZ@A
280 ; CHECK: struct `int __cdecl f(void)'::`2'::<unnamed-type-v> `int __cdecl f(void)'::`2'::v
282 ?v@?1???$f@H@@YAHXZ@4U<unnamed-type-v>@?1???$f@H@@YAHXZ@A
283 ; CHECK: struct `int __cdecl f<int>(void)'::`2'::<unnamed-type-v> `int __cdecl f<int>(void)'::`2'::v
285 ??2OverloadedNewDelete@@SAPAXI@Z
286 ; CHECK: static void * __cdecl OverloadedNewDelete::operator new(unsigned int)
289 ??_UOverloadedNewDelete@@SAPAXI@Z
290 ; CHECK: static void * __cdecl OverloadedNewDelete::operator new[](unsigned int)
292 ??3OverloadedNewDelete@@SAXPAX@Z
293 ; CHECK: static void __cdecl OverloadedNewDelete::operator delete(void *)
296 ??_VOverloadedNewDelete@@SAXPAX@Z
297 ; CHECK: static void __cdecl OverloadedNewDelete::operator delete[](void *)
299 ??HOverloadedNewDelete@@QAEHH@Z
300 ; CHECK: int __thiscall OverloadedNewDelete::operator+(int)
302 ??2OverloadedNewDelete@@SAPEAX_K@Z
303 ; CHECK: static void * __cdecl OverloadedNewDelete::operator new(unsigned __int64)
305 ??_UOverloadedNewDelete@@SAPEAX_K@Z
306 ; CHECK: static void * __cdecl OverloadedNewDelete::operator new[](unsigned __int64)
308 ??3OverloadedNewDelete@@SAXPEAX@Z
309 ; CHECK: static void __cdecl OverloadedNewDelete::operator delete(void *)
312 ??_VOverloadedNewDelete@@SAXPEAX@Z
313 ; CHECK: static void __cdecl OverloadedNewDelete::operator delete[](void *)
315 ??HOverloadedNewDelete@@QEAAHH@Z
316 ; CHECK: int __cdecl OverloadedNewDelete::operator+(int)
319 ??2TypedefNewDelete@@SAPAXI@Z
320 ; CHECK: static void * __cdecl TypedefNewDelete::operator new(unsigned int)
323 ??_UTypedefNewDelete@@SAPAXI@Z
324 ; CHECK: static void * __cdecl TypedefNewDelete::operator new[](unsigned int)
326 ??3TypedefNewDelete@@SAXPAX@Z
327 ; CHECK: static void __cdecl TypedefNewDelete::operator delete(void *)
329 ??_VTypedefNewDelete@@SAXPAX@Z
330 ; CHECK: static void __cdecl TypedefNewDelete::operator delete[](void *)
333 ; CHECK: void __vectorcall vector_func(void)
335 ??$fn_tmpl@$1?extern_c_func@@YAXXZ@@YAXXZ
336 ; CHECK: void __cdecl fn_tmpl<&void __cdecl extern_c_func(void)>(void)
338 ?overloaded_fn@@$$J0YAXXZ
339 ; CHECK: extern "C" void __cdecl overloaded_fn(void)
341 ?f@UnnamedType@@YAXQAPAU<unnamed-type-T1>@S@1@@Z
342 ; CHECK: void __cdecl UnnamedType::f(struct UnnamedType::S::<unnamed-type-T1> **const)
344 ?f@UnnamedType@@YAXUT2@S@1@@Z
345 ; CHECK: void __cdecl UnnamedType::f(struct UnnamedType::S::T2)
347 ?f@UnnamedType@@YAXPAUT4@S@1@@Z
348 ; CHECK: void __cdecl UnnamedType::f(struct UnnamedType::S::T4 *)
350 ?f@UnnamedType@@YAXUT4@S@1@@Z
351 ; CHECK: void __cdecl UnnamedType::f(struct UnnamedType::S::T4)
353 ?f@UnnamedType@@YAXUT5@S@1@@Z
354 ; CHECK: void __cdecl UnnamedType::f(struct UnnamedType::S::T5)
356 ?f@UnnamedType@@YAXUT2@S@1@@Z
357 ; CHECK: void __cdecl UnnamedType::f(struct UnnamedType::S::T2)
359 ?f@UnnamedType@@YAXUT4@S@1@@Z
360 ; CHECK: void __cdecl UnnamedType::f(struct UnnamedType::S::T4)
362 ?f@UnnamedType@@YAXUT5@S@1@@Z
363 ; CHECK: void __cdecl UnnamedType::f(struct UnnamedType::S::T5)
366 ; ?foo@PassObjectSize@@YAHQAHW4__pass_object_size0@__clang@@@Z
367 ; FIXME: int foo(int *const i __attribute__((pass_object_size(0))));
368 ; ?bar@PassObjectSize@@YAHQAHW4__pass_object_size1@__clang@@@Z
369 ; FIXME: int bar(int *const i __attribute__((pass_object_size(1))));
370 ; ?qux@PassObjectSize@@YAHQAHW4__pass_object_size1@__clang@@0W4__pass_object_size0@3@@Z
371 ; FIXME: int qux(int *const i __attribute__((pass_object_size(1))), int *const j __attribute__((pass_object_size(0))));
372 ; ?zot@PassObjectSize@@YAHQAHW4__pass_object_size1@__clang@@01@Z
373 ; FIXME: int zot(int *const i __attribute__((pass_object_size(1))), int *const j __attribute__((pass_object_size(1))));
377 ?f@Atomic@@YAXU?$_Atomic@H@__clang@@@Z
378 ; CHECK: void __cdecl Atomic::f(struct __clang::_Atomic<int>)
380 ?f@Complex@@YAXU?$_Complex@H@__clang@@@Z
381 ; CHECK: void __cdecl Complex::f(struct __clang::_Complex<int>)
383 ?f@Float16@@YAXU_Float16@__clang@@@Z
384 ; CHECK: void __cdecl Float16::f(struct __clang::_Float16)
388 ; CHECK: __cdecl NS::L<int>::L<int>(void)
391 ; CHECK: __cdecl Foo::Bar::Bar(void)
393 ??0?$L@V?$H@PAH@PR26029@@@PR26029@@QAE@XZ
394 ; CHECK: __thiscall PR26029::L<class PR26029::H<int *>>::L<class PR26029::H<int *>>(void)
396 ; ??$emplace_back@ABH@?$vector@HV?$allocator@H@std@@@std@@QAE?A?<decltype-auto>@@ABH@Z
397 <decltype-auto> __thiscall std::vector<int, class std::allocator<int>>::emplace_back<int const &>(int const &)