1 // Don't attempt slash switches on msys bash.
2 // REQUIRES: shell-preserves-root
3 // Exclude gcc-driven clang.
4 // REQUIRES: clang-driver
6 // Note: %s must be preceded by --, otherwise it may be interpreted as a
7 // command-line option, e.g. on Mac where %s is commonly under /Users.
12 // RUN: %clang_cl /c -### -- %s 2>&1 | FileCheck -check-prefix=C %s
15 // RUN: %clang_cl /Dfoo=bar -### -- %s 2>&1 | FileCheck -check-prefix=D %s
16 // RUN: %clang_cl /D foo=bar -### -- %s 2>&1 | FileCheck -check-prefix=D %s
19 // RTTI is on by default; just check that we don't error.
20 // RUN: %clang_cl /Zs /GR -- %s 2>&1
22 // RUN: %clang_cl /GR- -### -- %s 2>&1 | FileCheck -check-prefix=GR_ %s
25 // RUN: %clang_cl /Imyincludedir -### -- %s 2>&1 | FileCheck -check-prefix=I %s
26 // RUN: %clang_cl /I myincludedir -### -- %s 2>&1 | FileCheck -check-prefix=I %s
27 // I: "-I" "myincludedir"
29 // RUN: %clang_cl /J -### -- %s 2>&1 | FileCheck -check-prefix=J %s
30 // J: -fno-signed-char
32 // RUN: %clang_cl /Ofoo -### -- %s 2>&1 | FileCheck -check-prefix=O %s
35 // RUN: %clang_cl /Ob0 -### -- %s 2>&1 | FileCheck -check-prefix=Ob0 %s
38 // RUN: %clang_cl /Od -### -- %s 2>&1 | FileCheck -check-prefix=Od %s
41 // RUN: %clang_cl /Oi- /Oi -### -- %s 2>&1 | FileCheck -check-prefix=Oi %s
42 // Oi-NOT: -fno-builtin
44 // RUN: %clang_cl /Oi- -### -- %s 2>&1 | FileCheck -check-prefix=Oi_ %s
47 // RUN: %clang_cl /Os -### -- %s 2>&1 | FileCheck -check-prefix=Os %s
50 // RUN: %clang_cl /Ot -### -- %s 2>&1 | FileCheck -check-prefix=Ot %s
53 // RUN: %clang_cl /Ox -### -- %s 2>&1 | FileCheck -check-prefix=Ox %s
56 // RUN: %clang_cl /Zs /Oy -- %s 2>&1
58 // RUN: %clang_cl /Oy- -### -- %s 2>&1 | FileCheck -check-prefix=Oy_ %s
59 // Oy_: -mdisable-fp-elim
61 // RUN: %clang_cl /P -### -- %s 2>&1 | FileCheck -check-prefix=P %s
64 // RUN: %clang_cl /showIncludes -### -- %s 2>&1 | FileCheck -check-prefix=showIncludes %s
65 // showIncludes: --show-includes
67 // RUN: %clang_cl /Umymacro -### -- %s 2>&1 | FileCheck -check-prefix=U %s
68 // RUN: %clang_cl /U mymacro -### -- %s 2>&1 | FileCheck -check-prefix=U %s
71 // RUN: %clang_cl /W0 -### -- %s 2>&1 | FileCheck -check-prefix=W0 %s
74 // RUN: %clang_cl /W1 -### -- %s 2>&1 | FileCheck -check-prefix=W1 %s
75 // RUN: %clang_cl /W2 -### -- %s 2>&1 | FileCheck -check-prefix=W1 %s
76 // RUN: %clang_cl /W3 -### -- %s 2>&1 | FileCheck -check-prefix=W1 %s
77 // RUN: %clang_cl /W4 -### -- %s 2>&1 | FileCheck -check-prefix=W1 %s
78 // RUN: %clang_cl /Wall -### -- %s 2>&1 | FileCheck -check-prefix=W1 %s
81 // RUN: %clang_cl /WX -### -- %s 2>&1 | FileCheck -check-prefix=WX %s
84 // RUN: %clang_cl /WX- -### -- %s 2>&1 | FileCheck -check-prefix=WX_ %s
87 // RUN: %clang_cl /w -### -- %s 2>&1 | FileCheck -check-prefix=w %s
90 // RUN: %clang_cl /Zs -### -- %s 2>&1 | FileCheck -check-prefix=Zs %s
94 // Ignored options. Check that we don't get "unused during compilation" errors.
95 // (/Zs is for syntax-only, /WX is for -Werror)
96 // RUN: %clang_cl /Zs /WX /analyze- /errorReport:foo /nologo /Ob1 /Ob2 -- %s
97 // RUN: %clang_cl /Zs /WX /Zc:forScope /Zc:wchar_t /wd1234 -- %s
100 // Unsupported but parsed options. Check that we don't error on them.
101 // (/Zs is for syntax-only)
102 // RUN: %clang_cl /Zs /EHsc /Fdfoo /fp:precise /Gd /GL /GL- -- %s 2>&1
103 // RUN: %clang_cl /Zs /Gm /Gm- /GS /Gy /Gy- /GZ -- %s 2>&1
104 // RUN: %clang_cl /Zs /RTC1 /wfoo /Zc:wchar_t- -- %s 2>&1
105 // RUN: %clang_cl /Zs /ZI /Zi /MP -- %s 2>&1
108 // We support -Xclang for forwarding options to cc1.
109 // RUN: %clang_cl -Xclang hellocc1 -### -- %s 2>&1 | FileCheck -check-prefix=Xclang %s
111 // Xclang: "hellocc1"