blob: c67fc24484ee45218dbb3d7e4c2bef9cd4f06367 [file] [log] [blame]
Hans Wennborg24ffd632013-09-10 20:35:58 +00001// 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
Hans Wennborgcfdd8b52014-01-29 01:04:40 +000033
Yaron Keren1fdd7db2015-07-15 10:45:25 +000034// 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
Ehsan Akhgari7e954ea2014-09-12 18:15:10 +000036// TPlib: warning: cl-test.lib: 'linker' input unused
Ehsan Akhgaric249abb2014-09-12 21:44:24 +000037// TPlib: warning: argument unused during compilation: '/TP'
Ehsan Akhgari7e954ea2014-09-12 18:15:10 +000038// TPlib-NOT: cl-test.lib
39
Yaron Keren1fdd7db2015-07-15 10:45:25 +000040// 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
Ehsan Akhgari7e954ea2014-09-12 18:15:10 +000041// TClib: warning: cl-test.lib: 'linker' input unused
Ehsan Akhgaric249abb2014-09-12 21:44:24 +000042// TClib: warning: argument unused during compilation: '/TC'
Ehsan Akhgari7e954ea2014-09-12 18:15:10 +000043// TClib-NOT: cl-test.lib
44
Hans Wennborgcfdd8b52014-01-29 01:04:40 +000045// 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
Hans Wennborg23d26a32014-06-18 17:21:50 +000051// RUN: env LIB=%S/Inputs/cl-libs %clang_cl -### -- %s cl-test.lib 2>&1 | FileCheck -check-prefix=LIBINPUT %s
Reid Kleckner7d0c0662014-06-18 21:34:36 +000052// LIBINPUT: link.exe"
Hans Wennborg23d26a32014-06-18 17:21:50 +000053// 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'
Reid Kleckner7d0c0662014-06-18 21:34:36 +000057// LIBINPUT2: link.exe"
Hans Wennborg23d26a32014-06-18 17:21:50 +000058// LIBINPUT2-NOT: "cl-test2.lib"
59
Nico Weber1f0f1652015-04-24 22:16:53 +000060// 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
Hans Wennborgcfdd8b52014-01-29 01:04:40 +000065void f();