[clang-cl] Ignore /Wv and /Wv:17 flags
[llvm-project.git] / clang / test / CodeGenCXX / default_calling_conv.cpp
blob0991f862b881d5c296ff358ffbc5d7ff855b85f7
1 // RUN: %clang_cc1 -triple i386-unknown-linux-gnu -fdefault-calling-conv=cdecl -emit-llvm -o - %s | FileCheck %s --check-prefix=CDECL --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=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=ALL
4 // RUN: %clang_cc1 -triple i486-unknown-linux-gnu -mrtd -emit-llvm -o - %s | FileCheck %s --check-prefix=STDCALL --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=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=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
11 // CDECL: define{{.*}} void @_Z5test1v
12 // FASTCALL: define{{.*}} x86_fastcallcc void @_Z5test1v
13 // STDCALL: define{{.*}} x86_stdcallcc void @_Z5test1v
14 // VECTORCALL: define{{.*}} x86_vectorcallcc void @_Z5test1v
15 // REGCALL: define{{.*}} x86_regcallcc void @_Z17__regcall3__test1v
16 void test1() {}
18 // fastcall, stdcall, vectorcall and regcall do not support variadic functions.
19 // CDECL: define{{.*}} void @_Z12testVariadicz
20 // FASTCALL: define{{.*}} void @_Z12testVariadicz
21 // STDCALL: define{{.*}} void @_Z12testVariadicz
22 // VECTORCALL: define{{.*}} void @_Z12testVariadicz
23 // REGCALL: define{{.*}} void @_Z12testVariadicz
24 void testVariadic(...){}
26 // ALL: define{{.*}} void @_Z5test2v
27 void __attribute__((cdecl)) test2() {}
29 // ALL: define{{.*}} x86_fastcallcc void @_Z5test3v
30 void __attribute__((fastcall)) test3() {}
32 // ALL: define{{.*}} x86_stdcallcc void @_Z5test4v
33 void __attribute__((stdcall)) test4() {}
35 // ALL: define{{.*}} x86_vectorcallcc void @_Z5test5v
36 void __attribute__((vectorcall)) test5() {}
38 // ALL: define{{.*}} x86_regcallcc void @_Z17__regcall3__test6v
39 void __attribute__((regcall)) test6() {}
41 // ALL: define linkonce_odr void @_ZN1A11test_memberEv
42 class A {
43 public:
44 void test_member() {}
47 void test() {
48 A a;
49 a.test_member();
52 // ALL: define{{.*}} i32 @main
53 int main() {
54 return 1;
57 #ifdef WINDOWS
58 // WIN32: define dso_local noundef i32 @wmain
59 // WIN64: define dso_local noundef i32 @wmain
60 int wmain() {
61 return 1;
63 // WIN32: define dso_local x86_stdcallcc noundef i32 @WinMain
64 // WIN64: define dso_local noundef i32 @WinMain
65 int WinMain() {
66 return 1;
68 // WIN32: define dso_local x86_stdcallcc noundef i32 @wWinMain
69 // WIN64: define dso_local noundef i32 @wWinMain
70 int wWinMain() {
71 return 1;
73 // WIN32: define dso_local x86_stdcallcc noundef i32 @DllMain
74 // WIN64: define dso_local noundef i32 @DllMain
75 int DllMain() {
76 return 1;
78 #endif // Windows
80 #ifdef EXPLICITCC
81 // EXPLICITCC: define dso_local x86_fastcallcc noundef i32 @wmain
82 int __fastcall wmain() {
83 return 1;
85 // EXPLICITCC: define dso_local x86_fastcallcc noundef i32 @WinMain
86 int __fastcall WinMain() {
87 return 1;
89 // EXPLICITCC: define dso_local x86_fastcallcc noundef i32 @wWinMain
90 int __fastcall wWinMain() {
91 return 1;
93 // EXPLICITCC: define dso_local x86_fastcallcc noundef i32 @DllMain
94 int __fastcall DllMain() {
95 return 1;
97 #endif // ExplicitCC