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