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 // Add a dummy "other" entry to the path as well, to check that it's split
36 // around semicolons even on unix.
37 // RUN: env LIB="other;%S/Inputs/cl-libs" MSYS2_ARG_CONV_EXCL="/TP;/c" %clang_cl /c /TP cl-test.lib -### 2>&1 | FileCheck -check-prefix=TPlib %s
38 // TPlib: warning: cl-test.lib: 'linker' input unused
39 // TPlib: warning: argument unused during compilation: '/TP'
40 // TPlib-NOT: cl-test.lib
41 
42 // 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
43 // TClib: warning: cl-test.lib: 'linker' input unused
44 // TClib: warning: argument unused during compilation: '/TC'
45 // TClib-NOT: cl-test.lib
46 
47 // RUN: not %clang_cl - 2>&1 | FileCheck -check-prefix=STDIN %s
48 // STDIN: error: use /Tc or /Tp
49 
50 // RUN: %clang_cl -### /Tc - 2>&1 | FileCheck -check-prefix=STDINTc %s
51 // STDINTc: "-x" "c"
52 
53 // RUN: env LIB=%S/Inputs/cl-libs %clang_cl -### -- %s cl-test.lib 2>&1 | FileCheck -check-prefix=LIBINPUT %s
54 // LIBINPUT: link.exe"
55 // LIBINPUT: "cl-test.lib"
56 
57 // RUN: env LIB=%S/Inputs/cl-libs %clang_cl -### -- %s cl-test2.lib 2>&1 | FileCheck -check-prefix=LIBINPUT2 %s
58 // LIBINPUT2: error: no such file or directory: 'cl-test2.lib'
59 // LIBINPUT2: link.exe"
60 // LIBINPUT2-NOT: "cl-test2.lib"
61 
62 // RUN: %clang_cl -### -- %s /nonexisting.lib 2>&1 | FileCheck -check-prefix=LIBINPUT3 %s
63 // LIBINPUT3: error: no such file or directory: '/nonexisting.lib'
64 // LIBINPUT3: link.exe"
65 // LIBINPUT3-NOT: "/nonexisting.lib"
66 
67 void f();
68