[clang][modules] Don't prevent translation of FW_Private includes when explicitly...
[llvm-project.git] / clang / test / CodeGenCXX / default_calling_conv.cpp
blobff81f3712116d94683c7ff0cc57407b1f0286e1f
1 // RUN: %clang_cc1 -triple i386-unknown-linux-gnu -fdefault-calling-conv=cdecl -emit-llvm -o - %s | FileCheck %s --check-prefix=CDECL --check-prefix=X86 --check-prefix=ALL
2 // RUN: %clang_cc1 -triple i786-unknown-linux-gnu -target-feature +sse4.2 -fdefault-calling-conv=fastcall -emit-llvm -o - %s | FileCheck %s --check-prefix=FASTCALL --check-prefix=X86 --check-prefix=ALL
3 // RUN: %clang_cc1 -triple i486-unknown-linux-gnu -fdefault-calling-conv=stdcall -emit-llvm -o - %s | FileCheck %s --check-prefix=STDCALL --check-prefix=X86 --check-prefix=ALL
4 // RUN: %clang_cc1 -triple i486-unknown-linux-gnu -mrtd -emit-llvm -o - %s | FileCheck %s --check-prefix=STDCALL --check-prefix=X86 --check-prefix=ALL
5 // RUN: %clang_cc1 -triple i986-unknown-linux-gnu -fdefault-calling-conv=vectorcall -emit-llvm -o - %s | FileCheck %s --check-prefix=VECTORCALL --check-prefix=X86 --check-prefix=ALL
6 // RUN: %clang_cc1 -triple i986-unknown-linux-gnu -fdefault-calling-conv=regcall -emit-llvm -o - %s | FileCheck %s --check-prefix=REGCALL --check-prefix=X86 --check-prefix=ALL
7 // RUN: %clang_cc1 -triple i686-pc-win32 -fdefault-calling-conv=vectorcall -emit-llvm -o - %s -DWINDOWS | FileCheck %s --check-prefix=WIN32
8 // RUN: %clang_cc1 -triple x86_64-windows-msvc -fdefault-calling-conv=vectorcall -emit-llvm -o - %s -DWINDOWS | FileCheck %s --check-prefix=WIN64
9 // RUN: %clang_cc1 -triple i686-pc-win32 -emit-llvm -o - %s -DEXPLICITCC | FileCheck %s --check-prefix=EXPLICITCC
10 // RUN: %clang_cc1 -triple m68k-unknown-linux-gnu -mrtd -emit-llvm -o - %s | FileCheck %s --check-prefix=RTDCALL --check-prefix=ALL
11 // RUN: %clang_cc1 -triple m68k-unknown-linux-gnu -fdefault-calling-conv=rtdcall -emit-llvm -o - %s | FileCheck %s --check-prefix=RTDCALL --check-prefix=ALL
13 // CDECL: define{{.*}} void @_Z5test1v
14 // FASTCALL: define{{.*}} x86_fastcallcc void @_Z5test1v
15 // STDCALL: define{{.*}} x86_stdcallcc void @_Z5test1v
16 // VECTORCALL: define{{.*}} x86_vectorcallcc void @_Z5test1v
17 // REGCALL: define{{.*}} x86_regcallcc void @_Z17__regcall3__test1v
18 // RTDCALL: define{{.*}} m68k_rtdcc void @_Z5test1v
19 void test1() {}
21 // fastcall, stdcall, vectorcall, regcall and m68k_rtd do not support variadic functions.
22 // CDECL: define{{.*}} void @_Z12testVariadicz
23 // FASTCALL: define{{.*}} void @_Z12testVariadicz
24 // STDCALL: define{{.*}} void @_Z12testVariadicz
25 // VECTORCALL: define{{.*}} void @_Z12testVariadicz
26 // REGCALL: define{{.*}} void @_Z12testVariadicz
27 // RTDCALL: define{{.*}} void @_Z12testVariadicz
28 void testVariadic(...){}
30 // X86: define{{.*}} void @_Z5test2v
31 void __attribute__((cdecl)) test2() {}
33 // X86: define{{.*}} x86_fastcallcc void @_Z5test3v
34 void __attribute__((fastcall)) test3() {}
36 // X86: define{{.*}} x86_stdcallcc void @_Z5test4v
37 void __attribute__((stdcall)) test4() {}
39 // X86: define{{.*}} x86_vectorcallcc void @_Z5test5v
40 void __attribute__((vectorcall)) test5() {}
42 // X86: define{{.*}} x86_regcallcc void @_Z17__regcall3__test6v
43 void __attribute__((regcall)) test6() {}
45 // RTDCALL: define{{.*}} m68k_rtdcc void @_Z5test7v
46 void __attribute__((m68k_rtd)) test7() {}
48 // ALL: define linkonce_odr void @_ZN1A11test_memberEv
49 class A {
50 public:
51 void test_member() {}
54 void test() {
55 A a;
56 a.test_member();
58 // ALL: define internal void @"_ZZ{{.*}}testvENK3$_0clEi"
59 auto f = [](int b) {};
60 f(87);
63 // ALL: define{{.*}} i32 @main
64 int main() {
65 return 1;
68 #ifdef WINDOWS
69 // WIN32: define dso_local noundef i32 @wmain
70 // WIN64: define dso_local noundef i32 @wmain
71 int wmain() {
72 return 1;
74 // WIN32: define dso_local x86_stdcallcc noundef i32 @WinMain
75 // WIN64: define dso_local noundef i32 @WinMain
76 int WinMain() {
77 return 1;
79 // WIN32: define dso_local x86_stdcallcc noundef i32 @wWinMain
80 // WIN64: define dso_local noundef i32 @wWinMain
81 int wWinMain() {
82 return 1;
84 // WIN32: define dso_local x86_stdcallcc noundef i32 @DllMain
85 // WIN64: define dso_local noundef i32 @DllMain
86 int DllMain() {
87 return 1;
89 #endif // Windows
91 #ifdef EXPLICITCC
92 // EXPLICITCC: define dso_local x86_fastcallcc noundef i32 @wmain
93 int __fastcall wmain() {
94 return 1;
96 // EXPLICITCC: define dso_local x86_fastcallcc noundef i32 @WinMain
97 int __fastcall WinMain() {
98 return 1;
100 // EXPLICITCC: define dso_local x86_fastcallcc noundef i32 @wWinMain
101 int __fastcall wWinMain() {
102 return 1;
104 // EXPLICITCC: define dso_local x86_fastcallcc noundef i32 @DllMain
105 int __fastcall DllMain() {
106 return 1;
108 #endif // ExplicitCC