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.
4 // RUN: %clang_cl --target=i686-pc-win32 /fallback /Dfoo=bar /Ubaz /Ifoo /O0 /Ox /GR /GR- /GS /GS- /Gy /Gy- \
5 // RUN: /Gw /Gw- /LD /LDd /EHs /EHs- /Zl /MD /MDd /MTd /MT /FImyheader.h /Zi \
6 // RUN: -garbage -moregarbage \
7 // RUN: -### -- %s 2>&1 \
9 // CHECK: "-fdiagnostics-format" "msvc-fallback"
15 // CHECK: "-D" "foo=bar"
29 // CHECK: "/FImyheader.h"
37 // CHECK: "-moregarbage"
38 // CHECK: "/Tc" "{{.*cl-fallback.c}}"
39 // CHECK: "/Fo{{.*cl-fallback.*.obj}}"
41 // RUN: %clang_cl /fallback /GR- -### -- %s 2>&1 | FileCheck -check-prefix=GR %s
45 // RUN: %clang_cl /fallback /GS- -### -- %s 2>&1 | FileCheck -check-prefix=GS %s
49 // RUN: %clang_cl /fallback /Zc:threadSafeInit -### -- %s 2>&1 | FileCheck -check-prefix=ThreadSafe %s
50 // ThreadSafe: /Zc:threadSafeInit
52 // RUN: %clang_cl /fallback /Zc:threadSafeInit- -### -- %s 2>&1 | FileCheck -check-prefix=NonThreadSafe %s
53 // NonThreadSafe: /Zc:threadSafeInit-
55 // RUN: %clang_cl /fallback /Od -### -- %s 2>&1 | FileCheck -check-prefix=O0 %s
58 // RUN: %clang_cl --target=i686-pc-win32 /fallback /O1 -### -- %s 2>&1 | FileCheck -check-prefix=O1 %s
60 // O1: "/Og" "/Os" "/Ob2" "/Oy" "/GF" "/Gy"
61 // RUN: %clang_cl --target=i686-pc-win32 /fallback /O2 -### -- %s 2>&1 | FileCheck -check-prefix=O2 %s
63 // O2: "/Oi" "/Og" "/Ot" "/Ob2" "/Oy" "/GF" "/Gy"
64 // RUN: %clang_cl --target=i686-pc-win32 /fallback /Os -### -- %s 2>&1 | FileCheck -check-prefix=Os %s
67 // RUN: %clang_cl --target=i686-pc-win32 /fallback /Ox -### -- %s 2>&1 | FileCheck -check-prefix=Ox %s
69 // Ox: "/Oi" "/Og" "/Ot" "/Ob2" "/Oy" "/GF"
71 // Only fall back when actually compiling, not for e.g. /P (preprocess).
72 // RUN: %clang_cl /fallback /P -### -- %s 2>&1 | FileCheck -check-prefix=P %s
76 // RUN: not %clang_cl /fallback /c -- %s 2>&1 | \
77 // RUN: FileCheck -check-prefix=ErrWarn %s
78 // ErrWarn: warning: falling back to {{.*}}cl.exe
80 // RUN: %clang_cl /fallback /c /GR /GR- -### -- %s 2>&1 | \
81 // RUN: FileCheck -check-prefix=NO_RTTI %s
87 // Don't fall back on non-C or C++ files.
88 // RUN: %clang_cl /fallback -### -- %S/Inputs/file.ll 2>&1 | FileCheck -check-prefix=LL %s
94 #error "This fails to compile."