xref: /llvm-project/clang/test/Driver/cl-cc-flags.c (revision 6ee497aa0b48ad892447f29a90b4e61241949295)
1 // Note: %s must be preceded by --, otherwise it may be interpreted as a
2 // command-line option, e.g. on Mac where %s is commonly under /Users.
3 
4 // RUN: %clang_cl --target=i686-windows-msvc /Gd -### -- %s 2>&1 | FileCheck --check-prefix=CDECL %s
5 // CDECL: -fdefault-calling-conv=cdecl
6 
7 // RUN: %clang_cl --target=i686-windows-msvc /Gr -### -- %s 2>&1 | FileCheck --check-prefix=FASTCALL %s
8 // FASTCALL: -fdefault-calling-conv=fastcall
9 
10 // RUN: %clang_cl --target=i686-windows-msvc /Gz -### -- %s 2>&1 | FileCheck --check-prefix=STDCALL %s
11 // STDCALL: -fdefault-calling-conv=stdcall
12 
13 // RUN: %clang_cl --target=i686-windows-msvc /Gv -### -- %s 2>&1 | FileCheck --check-prefix=VECTORCALL %s
14 // VECTORCALL: -fdefault-calling-conv=vectorcall
15 
16 // RUN: %clang_cl --target=i686-windows-msvc /Gregcall -### -- %s 2>&1 | FileCheck --check-prefix=REGCALL %s
17 // REGCALL: -fdefault-calling-conv=regcall
18 
19 // RUN: %clang_cl --target=i686-windows-msvc /Gregcall /Gregcall4 -### -- %s 2>&1 | FileCheck --check-prefix=REGCALL4 %s
20 // REGCALL4: -fdefault-calling-conv=regcall
21 // REGCALL4: -regcall4
22 
23 // Last one should win:
24 
25 // RUN: %clang_cl --target=i686-windows-msvc /Gd /Gv -### -- %s 2>&1 | FileCheck --check-prefix=LASTWINS_VECTOR %s
26 // LASTWINS_VECTOR: -fdefault-calling-conv=vectorcall
27 
28 // RUN: %clang_cl --target=i686-windows-msvc /Gv /Gd -### -- %s 2>&1 | FileCheck --check-prefix=LASTWINS_CDECL %s
29 // LASTWINS_CDECL: -fdefault-calling-conv=cdecl
30 
31 // No fastcall or stdcall on x86_64:
32 
33 // RUN: %clang_cl -Wno-msvc-not-found --target=x86_64-windows-msvc /Gr -### -- %s 2>&1 | FileCheck --check-prefix=UNAVAILABLE %s
34 // RUN: %clang_cl -Wno-msvc-not-found --target=x86_64-windows-msvc /Gz -### -- %s 2>&1 | FileCheck --check-prefix=UNAVAILABLE %s
35 // RUN: %clang_cl -Wno-msvc-not-found --target=thumbv7-windows-msvc /Gv -### -- %s 2>&1 | FileCheck --check-prefix=UNAVAILABLE %s
36 
37 // UNAVAILABLE-NOT: error:
38 // UNAVAILABLE-NOT: warning:
39 // UNAVAILABLE-NOT: -fdefault-calling-conv=
40 
41