xref: /minix3/external/bsd/llvm/dist/clang/test/CodeGenCXX/mangle-windows.cpp (revision 0a6a1f1d05b60e214de2f05a7310ddd1f0e590e7)
1*0a6a1f1dSLionel Sambuc // RUN: %clang_cc1 -emit-llvm %s -o - -triple=i386-pc-win32 | \
2*0a6a1f1dSLionel Sambuc // RUN:     FileCheck --check-prefix=WIN %s
3f4a2713aSLionel Sambuc //
4f4a2713aSLionel Sambuc // RUN: %clang_cc1 -emit-llvm %s -o - -triple=i386-mingw32 | \
5f4a2713aSLionel Sambuc // RUN:     FileCheck --check-prefix=ITANIUM %s
6f4a2713aSLionel Sambuc 
f1(void)7f4a2713aSLionel Sambuc void __stdcall f1(void) {}
8f4a2713aSLionel Sambuc // WIN: define x86_stdcallcc void @"\01?f1@@YGXXZ"
9f4a2713aSLionel Sambuc // ITANIUM: define x86_stdcallcc void @"\01__Z2f1v@0"
10f4a2713aSLionel Sambuc 
f2(void)11f4a2713aSLionel Sambuc void __fastcall f2(void) {}
12f4a2713aSLionel Sambuc // WIN: define x86_fastcallcc void @"\01?f2@@YIXXZ"
13f4a2713aSLionel Sambuc // ITANIUM: define x86_fastcallcc void @"\01@_Z2f2v@0"
14f4a2713aSLionel Sambuc 
f3(void)15f4a2713aSLionel Sambuc extern "C" void __stdcall f3(void) {}
16f4a2713aSLionel Sambuc // WIN: define x86_stdcallcc void @"\01_f3@0"
17f4a2713aSLionel Sambuc // ITANIUM: define x86_stdcallcc void @"\01_f3@0"
18f4a2713aSLionel Sambuc 
f4(void)19f4a2713aSLionel Sambuc extern "C" void __fastcall f4(void) {}
20f4a2713aSLionel Sambuc // WIN: define x86_fastcallcc void @"\01@f4@0"
21f4a2713aSLionel Sambuc // ITANIUM: define x86_fastcallcc void @"\01@f4@0"
22f4a2713aSLionel Sambuc 
23f4a2713aSLionel Sambuc struct Foo {
24f4a2713aSLionel Sambuc   void __stdcall foo();
25f4a2713aSLionel Sambuc   static void __stdcall bar();
26f4a2713aSLionel Sambuc };
27f4a2713aSLionel Sambuc 
foo()28f4a2713aSLionel Sambuc void Foo::foo() {}
29f4a2713aSLionel Sambuc // WIN: define x86_stdcallcc void @"\01?foo@Foo@@QAGXXZ"
30f4a2713aSLionel Sambuc // ITANIUM: define x86_stdcallcc void @"\01__ZN3Foo3fooEv@4"
31f4a2713aSLionel Sambuc 
bar()32f4a2713aSLionel Sambuc void Foo::bar() {}
33f4a2713aSLionel Sambuc // WIN: define x86_stdcallcc void @"\01?bar@Foo@@SGXXZ"
34f4a2713aSLionel Sambuc // ITANIUM: define x86_stdcallcc void @"\01__ZN3Foo3barEv@0"
35f4a2713aSLionel Sambuc 
36f4a2713aSLionel Sambuc // Mostly a test that we don't crash and that the names start with a \01.
37f4a2713aSLionel Sambuc // gcc on mingw produces __Zpp@4
38f4a2713aSLionel Sambuc // cl produces _++@4
operator ++(Foo & x)39f4a2713aSLionel Sambuc extern "C" void __stdcall operator++(Foo &x) {
40f4a2713aSLionel Sambuc }
41f4a2713aSLionel Sambuc // WIN: define x86_stdcallcc void @"\01??E@YGXAAUFoo@@@Z"
42f4a2713aSLionel Sambuc // ITANIUM: define x86_stdcallcc void @"\01__ZppR3Foo@4"
43