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 /TC -### -- %s 2>&1 | FileCheck -check-prefix=TC %s
5 // TC:  "-x" "c"
6 // TC-NOT: warning
7 // TC-NOT: note
8 
9 // RUN: %clang_cl /TP -### -- %s 2>&1 | FileCheck -check-prefix=TP %s
10 // TP:  "-x" "c++"
11 // TP-NOT: warning
12 // TP-NOT: note
13 
14 // RUN: %clang_cl -### /Tc%s /TP -- %s 2>&1 | FileCheck -check-prefix=Tc %s
15 // RUN: %clang_cl -### /TP /Tc%s -- %s 2>&1 | FileCheck -check-prefix=Tc %s
16 // Tc:  "-x" "c"
17 // Tc:  "-x" "c++"
18 // Tc-NOT: warning
19 // Tc-NOT: note
20 
21 // RUN: %clang_cl -### /Tp%s /TC -- %s 2>&1 | FileCheck -check-prefix=Tp %s
22 // RUN: %clang_cl -### /TC /Tp%s -- %s 2>&1 | FileCheck -check-prefix=Tp %s
23 // Tp:  "-x" "c++"
24 // Tp:  "-x" "c"
25 // Tp-NOT: warning
26 // Tp-NOT: note
27 
28 // RUN: %clang_cl /TP /TC /TP -### -- %s 2>&1 | FileCheck -check-prefix=WARN %s
29 // WARN: warning: overriding '/TP' option with '/TC'
30 // WARN: warning: overriding '/TC' option with '/TP'
31 // WARN: note: The last /TC or /TP option takes precedence over earlier instances
32 // WARN-NOT: note
33 
34 // MSYS2_ARG_CONV_EXCL tells MSYS2 to skip conversion of the specified argument.
35 // RUN: env LIB=%S/Inputs/cl-libs MSYS2_ARG_CONV_EXCL="/TP;/c" %clang_cl /c /TP cl-test.lib -### 2>&1 | FileCheck -check-prefix=TPlib %s
36 // TPlib: warning: cl-test.lib: 'linker' input unused
37 // TPlib: warning: argument unused during compilation: '/TP'
38 // TPlib-NOT: cl-test.lib
39 
40 // RUN: env LIB=%S/Inputs/cl-libs MSYS2_ARG_CONV_EXCL="/TC;/c" %clang_cl /c /TC cl-test.lib -### 2>&1 | FileCheck -check-prefix=TClib %s
41 // TClib: warning: cl-test.lib: 'linker' input unused
42 // TClib: warning: argument unused during compilation: '/TC'
43 // TClib-NOT: cl-test.lib
44 
45 // RUN: not %clang_cl - 2>&1 | FileCheck -check-prefix=STDIN %s
46 // STDIN: error: use /Tc or /Tp
47 
48 // RUN: %clang_cl -### /Tc - 2>&1 | FileCheck -check-prefix=STDINTc %s
49 // STDINTc: "-x" "c"
50 
51 // RUN: env LIB=%S/Inputs/cl-libs %clang_cl -### -- %s cl-test.lib 2>&1 | FileCheck -check-prefix=LIBINPUT %s
52 // LIBINPUT: link.exe"
53 // LIBINPUT: "cl-test.lib"
54 
55 // RUN: env LIB=%S/Inputs/cl-libs %clang_cl -### -- %s cl-test2.lib 2>&1 | FileCheck -check-prefix=LIBINPUT2 %s
56 // LIBINPUT2: error: no such file or directory: 'cl-test2.lib'
57 // LIBINPUT2: link.exe"
58 // LIBINPUT2-NOT: "cl-test2.lib"
59 
60 // RUN: %clang_cl -### -- %s /nonexisting.lib 2>&1 | FileCheck -check-prefix=LIBINPUT3 %s
61 // LIBINPUT3: error: no such file or directory: '/nonexisting.lib'
62 // LIBINPUT3: link.exe"
63 // LIBINPUT3-NOT: "/nonexisting.lib"
64 
65 void f();
66