blob: 1bb0993d27d40cb7d647ddf572cd42f9249b70d6 [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- \
Stephen Hines6bcf27b2014-05-29 04:14:42 -07008// RUN: /Gw /Gw- /LD /LDd /MD /MDd /MTd /MT /FImyheader.h /Zi \
9// RUN: -### -- %s 2>&1 \
Stephen Hines651f13c2014-04-23 16:59:28 -070010// RUN: | FileCheck %s
Hans Wennborg89e32742013-09-24 00:08:55 +000011// CHECK: "-fdiagnostics-format" "msvc-fallback"
Hans Wennborgc8ba0a02013-09-19 20:32:16 +000012// CHECK: ||
13// CHECK: cl.exe
Hans Wennborg1413d622013-09-24 17:36:21 +000014// CHECK: "/nologo"
Hans Wennborgc8ba0a02013-09-19 20:32:16 +000015// CHECK: "/c"
16// CHECK: "/W0"
17// CHECK: "-D" "foo=bar"
18// CHECK: "-U" "baz"
19// CHECK: "-I" "foo"
Hans Wennborga8ffc162013-09-24 18:17:21 +000020// CHECK: "/Ox"
Hans Wennborgc8ba0a02013-09-19 20:32:16 +000021// CHECK: "/GR-"
Stephen Hines651f13c2014-04-23 16:59:28 -070022// CHECK: "/Gy-"
Stephen Hines6bcf27b2014-05-29 04:14:42 -070023// CHECK: "/Gw-"
Stephen Hines651f13c2014-04-23 16:59:28 -070024// CHECK: "/Z7"
Hans Wennborg4fe475a2013-09-27 17:54:18 +000025// CHECK: "/FImyheader.h"
Hans Wennborgc8ba0a02013-09-19 20:32:16 +000026// CHECK: "/LD"
27// CHECK: "/LDd"
28// CHECK: "/MT"
29// CHECK: "/Tc" "{{.*cl-fallback.c}}"
30// CHECK: "/Fo{{.*cl-fallback.*.obj}}"
Hans Wennborga8ffc162013-09-24 18:17:21 +000031
32// RUN: %clang_cl /fallback /Od -### -- %s 2>&1 | FileCheck -check-prefix=O0 %s
33// O0: cl.exe
34// O0: "/Od"
35// RUN: %clang_cl /fallback /O1 -### -- %s 2>&1 | FileCheck -check-prefix=O1 %s
36// O1: cl.exe
37// O1: "-O1"
38// RUN: %clang_cl /fallback /O2 -### -- %s 2>&1 | FileCheck -check-prefix=O2 %s
39// O2: cl.exe
40// O2: "-O2"
41// RUN: %clang_cl /fallback /Os -### -- %s 2>&1 | FileCheck -check-prefix=Os %s
42// Os: cl.exe
43// Os: "-Os"
44// RUN: %clang_cl /fallback /Ox -### -- %s 2>&1 | FileCheck -check-prefix=Ox %s
45// Ox: cl.exe
46// Ox: "/Ox"
Stephen Hines651f13c2014-04-23 16:59:28 -070047
48// Only fall back when actually compiling, not for e.g. /P (preprocess).
49// RUN: %clang_cl /fallback /P -### -- %s 2>&1 | FileCheck -check-prefix=P %s
50// P-NOT: ||
51// P-NOT: "cl.exe"
52
53// RUN: not %clang_cl /fallback /c -- %s 2>&1 | \
54// RUN: FileCheck -check-prefix=ErrWarn %s
55// ErrWarn: warning: falling back to {{.*}}cl.exe
56
Stephen Hines6bcf27b2014-05-29 04:14:42 -070057// Don't attempt to run clang -cc1 with /fallback and /GR. It isn't ready yet.
58// RUN: %clang_cl /fallback /c /GR -### -- %s 2>&1 | \
59// RUN: FileCheck -check-prefix=RTTI %s
60// RTTI: warning: cannot compile RTTI yet, falling back to {{.*}}cl.exe
61// RUN: %clang_cl /fallback /c /GR /GR- -### -- %s 2>&1 | \
62// RUN: FileCheck -check-prefix=NO_RTTI %s
63// NO_RTTI: "-cc1"
64// NO_RTTI: ||
65// NO_RTTI: cl.exe
66
67// Don't fall back on non-C or C++ files.
68// RUN: %clang_cl /fallback -### -- %S/Inputs/file.ll 2>&1 | FileCheck -check-prefix=LL %s
69// LL: file.ll
70// LL-NOT: ||
71// LL-NOT: "cl.exe"
72
73
Stephen Hines651f13c2014-04-23 16:59:28 -070074#error "This fails to compile."