blob: d90e5fa496461f2403076274231382b0ee0ca9e9 [file] [log] [blame]
Hans Wennborgc8ba0a02013-09-19 20:32:16 +00001// Don't attempt slash switches on msys bash.
2// REQUIRES: shell-preserves-root
3
4// Note: %s must be preceded by --, otherwise it may be interpreted as a
5// command-line option, e.g. on Mac where %s is commonly under /Users.
6
Stephen Hines651f13c2014-04-23 16:59:28 -07007// RUN: %clang_cl /fallback /Dfoo=bar /Ubaz /Ifoo /O0 /Ox /GR /GR- /Gy /Gy- \
8// RUN: /LD /LDd /MD /MDd /MTd /MT /FImyheader.h /Zi -### -- %s 2>&1 \
9// RUN: | FileCheck %s
Hans Wennborg89e32742013-09-24 00:08:55 +000010// CHECK: "-fdiagnostics-format" "msvc-fallback"
Hans Wennborgc8ba0a02013-09-19 20:32:16 +000011// CHECK: ||
12// CHECK: cl.exe
Hans Wennborg1413d622013-09-24 17:36:21 +000013// CHECK: "/nologo"
Hans Wennborgc8ba0a02013-09-19 20:32:16 +000014// CHECK: "/c"
15// CHECK: "/W0"
16// CHECK: "-D" "foo=bar"
17// CHECK: "-U" "baz"
18// CHECK: "-I" "foo"
Hans Wennborga8ffc162013-09-24 18:17:21 +000019// CHECK: "/Ox"
Hans Wennborgc8ba0a02013-09-19 20:32:16 +000020// CHECK: "/GR-"
Stephen Hines651f13c2014-04-23 16:59:28 -070021// CHECK: "/Gy-"
22// CHECK: "/Z7"
Hans Wennborg4fe475a2013-09-27 17:54:18 +000023// CHECK: "/FImyheader.h"
Hans Wennborgc8ba0a02013-09-19 20:32:16 +000024// CHECK: "/LD"
25// CHECK: "/LDd"
26// CHECK: "/MT"
27// CHECK: "/Tc" "{{.*cl-fallback.c}}"
28// CHECK: "/Fo{{.*cl-fallback.*.obj}}"
Hans Wennborga8ffc162013-09-24 18:17:21 +000029
30// RUN: %clang_cl /fallback /Od -### -- %s 2>&1 | FileCheck -check-prefix=O0 %s
31// O0: cl.exe
32// O0: "/Od"
33// RUN: %clang_cl /fallback /O1 -### -- %s 2>&1 | FileCheck -check-prefix=O1 %s
34// O1: cl.exe
35// O1: "-O1"
36// RUN: %clang_cl /fallback /O2 -### -- %s 2>&1 | FileCheck -check-prefix=O2 %s
37// O2: cl.exe
38// O2: "-O2"
39// RUN: %clang_cl /fallback /Os -### -- %s 2>&1 | FileCheck -check-prefix=Os %s
40// Os: cl.exe
41// Os: "-Os"
42// RUN: %clang_cl /fallback /Ox -### -- %s 2>&1 | FileCheck -check-prefix=Ox %s
43// Ox: cl.exe
44// Ox: "/Ox"
Stephen Hines651f13c2014-04-23 16:59:28 -070045
46// Only fall back when actually compiling, not for e.g. /P (preprocess).
47// RUN: %clang_cl /fallback /P -### -- %s 2>&1 | FileCheck -check-prefix=P %s
48// P-NOT: ||
49// P-NOT: "cl.exe"
50
51// RUN: not %clang_cl /fallback /c -- %s 2>&1 | \
52// RUN: FileCheck -check-prefix=ErrWarn %s
53// ErrWarn: warning: falling back to {{.*}}cl.exe
54
55#error "This fails to compile."