// Alias options:
-// RUN: %clang_cl /c -### -- %s 2>&1 | FileCheck -check-prefix=C %s
-// C: -c
+// RUN: %clang_cl /c -### -- %s 2>&1 | FileCheck -check-prefix=c %s
+// c: -c
+
+// RUN: %clang_cl /C -### -- %s 2>&1 | FileCheck -check-prefix=C %s
+// C: error: invalid argument '-C' only allowed with '/E, /P or /EP'
+
+// RUN: %clang_cl /C /P -### -- %s 2>&1 | FileCheck -check-prefix=C_P %s
+// C_P: "-E"
+// C_P: "-C"
// RUN: %clang_cl /Dfoo=bar -### -- %s 2>&1 | FileCheck -check-prefix=D %s
// RUN: %clang_cl /D foo=bar -### -- %s 2>&1 | FileCheck -check-prefix=D %s
// D: "-D" "foo=bar"
+// RUN: %clang_cl /E -### -- %s 2>&1 | FileCheck -check-prefix=E %s
+// E: "-E"
+// E: "-o" "-"
+
+// RUN: %clang_cl /EP -### -- %s 2>&1 | FileCheck -check-prefix=EP %s
+// EP: "-E"
+// EP: "-P"
+// EP: "-o" "-"
+
// RTTI is on by default; just check that we don't error.
// RUN: %clang_cl /Zs /GR -- %s 2>&1
// RUN: %clang_cl /GR- -### -- %s 2>&1 | FileCheck -check-prefix=GR_ %s
// GR_: -fno-rtti
-// RUN: %clang_cl /Imyincludedir -### -- %s 2>&1 | FileCheck -check-prefix=I %s
-// RUN: %clang_cl /I myincludedir -### -- %s 2>&1 | FileCheck -check-prefix=I %s
-// I: "-I" "myincludedir"
+// RUN: %clang_cl /Gy -### -- %s 2>&1 | FileCheck -check-prefix=Gy %s
+// Gy: -ffunction-sections
+
+// RUN: %clang_cl /Gy /Gy- -### -- %s 2>&1 | FileCheck -check-prefix=Gy_ %s
+// Gy_-NOT: -ffunction-sections
+
+// RUN: %clang_cl /Gs -### -- %s 2>&1 | FileCheck -check-prefix=Gs %s
+// Gs: "-mstack-probe-size=0"
+// RUN: %clang_cl /Gs0 -### -- %s 2>&1 | FileCheck -check-prefix=Gs0 %s
+// Gs0: "-mstack-probe-size=0"
+// RUN: %clang_cl /Gs4096 -### -- %s 2>&1 | FileCheck -check-prefix=Gs4096 %s
+// Gs4096: "-mstack-probe-size=4096"
+
+// RUN: %clang_cl /Gw -### -- %s 2>&1 | FileCheck -check-prefix=Gw %s
+// Gw: -fdata-sections
+
+// RUN: %clang_cl /Gw /Gw- -### -- %s 2>&1 | FileCheck -check-prefix=Gw_ %s
+// Gw_-NOT: -fdata-sections
+
+// RUN: %clang_cl /Imyincludedir -### -- %s 2>&1 | FileCheck -check-prefix=SLASH_I %s
+// RUN: %clang_cl /I myincludedir -### -- %s 2>&1 | FileCheck -check-prefix=SLASH_I %s
+// SLASH_I: "-I" "myincludedir"
// RUN: %clang_cl /J -### -- %s 2>&1 | FileCheck -check-prefix=J %s
// J: -fno-signed-char
// RUN: %clang_cl /Oy- -### -- %s 2>&1 | FileCheck -check-prefix=Oy_ %s
// Oy_: -mdisable-fp-elim
-// RUN: %clang_cl /P -### -- %s 2>&1 | FileCheck -check-prefix=P %s
-// P: -E
-
// RUN: %clang_cl /showIncludes -### -- %s 2>&1 | FileCheck -check-prefix=showIncludes %s
// showIncludes: --show-includes
+// RUN: %clang_cl /E /showIncludes -### -- %s 2>&1 | FileCheck -check-prefix=showIncludes_E %s
+// RUN: %clang_cl /EP /showIncludes -### -- %s 2>&1 | FileCheck -check-prefix=showIncludes_E %s
+// showIncludes_E: warning: argument unused during compilation: '--show-includes'
+
// RUN: %clang_cl /Umymacro -### -- %s 2>&1 | FileCheck -check-prefix=U %s
// RUN: %clang_cl /U mymacro -### -- %s 2>&1 | FileCheck -check-prefix=U %s
// U: "-U" "mymacro"
+// RUN: %clang_cl /vd2 -### -- %s 2>&1 | FileCheck -check-prefix=VD2 %s
+// VD2: -vtordisp-mode=2
+
+// RUN: %clang_cl /vmg -### -- %s 2>&1 | FileCheck -check-prefix=VMG %s
+// VMG: "-fms-memptr-rep=virtual"
+
+// RUN: %clang_cl /vmg /vms -### -- %s 2>&1 | FileCheck -check-prefix=VMS %s
+// VMS: "-fms-memptr-rep=single"
+
+// RUN: %clang_cl /vmg /vmm -### -- %s 2>&1 | FileCheck -check-prefix=VMM %s
+// VMM: "-fms-memptr-rep=multiple"
+
+// RUN: %clang_cl /vmg /vmv -### -- %s 2>&1 | FileCheck -check-prefix=VMV %s
+// VMV: "-fms-memptr-rep=virtual"
+
+// RUN: %clang_cl /vmg /vmb -### -- %s 2>&1 | FileCheck -check-prefix=VMB %s
+// VMB: '/vmg' not allowed with '/vmb'
+
+// RUN: %clang_cl /vmg /vmm /vms -### -- %s 2>&1 | FileCheck -check-prefix=VMX %s
+// VMX: '/vms' not allowed with '/vmm'
+
+// RUN: %clang_cl /volatile:iso -### -- %s 2>&1 | FileCheck -check-prefix=VOLATILE-ISO %s
+// VOLATILE-ISO-NOT: "-fms-volatile"
+
+// RUN: %clang_cl /volatile:ms -### -- %s 2>&1 | FileCheck -check-prefix=VOLATILE-MS %s
+// VOLATILE-MS: "-fms-volatile"
+
// RUN: %clang_cl /W0 -### -- %s 2>&1 | FileCheck -check-prefix=W0 %s
// W0: -w
// RUN: %clang_cl /w -### -- %s 2>&1 | FileCheck -check-prefix=w %s
// w: -w
+// RUN: %clang_cl /Zp -### -- %s 2>&1 | FileCheck -check-prefix=ZP %s
+// ZP: -fpack-struct=1
+
+// RUN: %clang_cl /Zp2 -### -- %s 2>&1 | FileCheck -check-prefix=ZP2 %s
+// ZP2: -fpack-struct=2
+
// RUN: %clang_cl /Zs -### -- %s 2>&1 | FileCheck -check-prefix=Zs %s
// Zs: -fsyntax-only
+// RUN: %clang_cl /FIasdf.h -### -- %s 2>&1 | FileCheck -check-prefix=FI %s
+// FI: "-include" "asdf.h"
+
+// RUN: %clang_cl /FI asdf.h -### -- %s 2>&1 | FileCheck -check-prefix=FI_ %s
+// FI_: "-include" "asdf.h"
+
// We forward any unrecognized -W diagnostic options to cc1.
// RUN: %clang_cl -Wunused-pragmas -### -- %s 2>&1 | FileCheck -check-prefix=WJoined %s
// WJoined: "-cc1"
// WJoined: "-Wunused-pragmas"
+// We recognize -f[no-]strict-aliasing.
+// RUN: %clang_cl -c -### -- %s 2>&1 | FileCheck -check-prefix=DEFAULTSTRICT %s
+// DEFAULTSTRICT: "-relaxed-aliasing"
+// RUN: %clang_cl -c -fstrict-aliasing -### -- %s 2>&1 | FileCheck -check-prefix=STRICT %s
+// STRICT-NOT: "-relaxed-aliasing"
+// RUN: %clang_cl -c -fno-strict-aliasing -### -- %s 2>&1 | FileCheck -check-prefix=NOSTRICT %s
+// NOSTRICT: "-relaxed-aliasing"
+
+// For some warning ids, we can map from MSVC warning to Clang warning.
+// RUN: %clang_cl -wd4005 -wd4996 -### -- %s 2>&1 | FileCheck -check-prefix=Wno %s
+// Wno: "-cc1"
+// Wno: "-Wno-macro-redefined"
+// Wno: "-Wno-deprecated-declarations"
+
// Ignored options. Check that we don't get "unused during compilation" errors.
-// (/Zs is for syntax-only, /WX is for -Werror)
-// RUN: %clang_cl /Zs /WX /analyze- /errorReport:foo /nologo /Ob1 /Ob2 -- %s
-// RUN: %clang_cl /Zs /WX /Zc:forScope /Zc:wchar_t /w12345 /wd1234 /RTC1 -- %s
+// RUN: %clang_cl /c \
+// RUN: /analyze- \
+// RUN: /cgthreads4 \
+// RUN: /cgthreads8 \
+// RUN: /d2Zi+ \
+// RUN: /errorReport:foo \
+// RUN: /Fdfoo \
+// RUN: /FS \
+// RUN: /Gd \
+// RUN: /GF \
+// RUN: /GS- \
+// RUN: /kernel- \
+// RUN: /nologo \
+// RUN: /Ob1 \
+// RUN: /Ob2 \
+// RUN: /openmp- \
+// RUN: /RTC1 \
+// RUN: /sdl \
+// RUN: /sdl- \
+// RUN: /vmg \
+// RUN: /volatile:iso \
+// RUN: /w12345 \
+// RUN: /wd1234 \
+// RUN: /Zo \
+// RUN: /Zo- \
+// RUN: -### -- %s 2>&1 | FileCheck -check-prefix=IGNORED %s
+// IGNORED-NOT: argument unused during compilation
+// IGNORED-NOT: no such file or directory
+// Don't confuse /openmp- with the /o flag:
+// IGNORED-NOT: "-o" "penmp-.obj"
+
+// Ignored options and compile-only options are ignored for link jobs.
+// RUN: touch %t.obj
+// RUN: %clang_cl /nologo -### -- %t.obj 2>&1 | FileCheck -check-prefix=LINKUNUSED %s
+// RUN: %clang_cl /Dfoo -### -- %t.obj 2>&1 | FileCheck -check-prefix=LINKUNUSED %s
+// RUN: %clang_cl /MD -### -- %t.obj 2>&1 | FileCheck -check-prefix=LINKUNUSED %s
+// LINKUNUSED-NOT: argument unused during compilation
// Support ignoring warnings about unused arguments.
// RUN: %clang_cl /Abracadabra -Qunused-arguments -### -- %s 2>&1 | FileCheck -check-prefix=UNUSED %s
-// UNUSED-NOT: warning
-
+// UNUSED-NOT: argument unused during compilation
// Unsupported but parsed options. Check that we don't error on them.
// (/Zs is for syntax-only)
-// RUN: %clang_cl /Zs /EHsc /Fdfoo /fp:precise /Gd /GL /GL- -- %s 2>&1
-// RUN: %clang_cl /Zs /Gm /Gm- /GS /Gy /Gy- /GZ -- %s 2>&1
-// RUN: %clang_cl /Zs /ofoo.obj /o foo.obj -- %s 2>&1
-// RUN: %clang_cl /Zs /wfoo /Zc:wchar_t- -- %s 2>&1
-// RUN: %clang_cl /Zs /ZI /Zi /MP -- %s 2>&1
-
+// RUN: %clang_cl /Zs \
+// RUN: /AIfoo \
+// RUN: /clr:pure \
+// RUN: /docname \
+// RUN: /EHsc \
+// RUN: /F \
+// RUN: /FA \
+// RUN: /FAc \
+// RUN: /Fafilename \
+// RUN: /FAs \
+// RUN: /FAu \
+// RUN: /favor:blend \
+// RUN: /FC \
+// RUN: /Fifoo \
+// RUN: /Fmfoo \
+// RUN: /FpDebug\main.pch \
+// RUN: /fp:precise \
+// RUN: /Frfoo \
+// RUN: /FRfoo \
+// RUN: /FU foo \
+// RUN: /Fx \
+// RUN: /G1 \
+// RUN: /G2 \
+// RUN: /GA \
+// RUN: /Gd \
+// RUN: /Ge \
+// RUN: /Gh \
+// RUN: /GH \
+// RUN: /GL \
+// RUN: /GL- \
+// RUN: /Gm \
+// RUN: /Gm- \
+// RUN: /Gr \
+// RUN: /GS \
+// RUN: /GT \
+// RUN: /GX \
+// RUN: /Gv \
+// RUN: /Gz \
+// RUN: /GZ \
+// RUN: /H \
+// RUN: /homeparams \
+// RUN: /hotpatch \
+// RUN: /kernel \
+// RUN: /LN \
+// RUN: /MP \
+// RUN: /o foo.obj \
+// RUN: /ofoo.obj \
+// RUN: /openmp \
+// RUN: /Qfast_transcendentals \
+// RUN: /QIfist \
+// RUN: /Qimprecise_fwaits \
+// RUN: /Qpar \
+// RUN: /Qvec-report:2 \
+// RUN: /u \
+// RUN: /V \
+// RUN: /volatile:ms \
+// RUN: /wfoo \
+// RUN: /WL \
+// RUN: /Wp64 \
+// RUN: /X \
+// RUN: /Y- \
+// RUN: /Yc \
+// RUN: /Ycstdafx.h \
+// RUN: /Yd \
+// RUN: /Yl- \
+// RUN: /Ylfoo \
+// RUN: /Yustdafx.h \
+// RUN: /Z7 \
+// RUN: /Za \
+// RUN: /Ze \
+// RUN: /Zg \
+// RUN: /Zi \
+// RUN: /ZI \
+// RUN: /Zl \
+// RUN: /ZW:nostdlib \
+// RUN: -- %s 2>&1
// We support -Xclang for forwarding options to cc1.
// RUN: %clang_cl -Xclang hellocc1 -### -- %s 2>&1 | FileCheck -check-prefix=Xclang %s
// Xclang: "-cc1"
// Xclang: "hellocc1"
+
+// RTTI is on by default. /GR- controls -fno-rtti-data.
+// RUN: %clang_cl /c /GR- -### -- %s 2>&1 | FileCheck -check-prefix=NoRTTI %s
+// NoRTTI: "-fno-rtti-data"
+// NoRTTI-NOT: "-fno-rtti"
+// RUN: %clang_cl /c /GR -### -- %s 2>&1 | FileCheck -check-prefix=RTTI %s
+// RTTI-NOT: "-fno-rtti-data"
+// RTTI-NOT: "-fno-rtti"
+
+// Accept "core" clang options.
+// (/Zs is for syntax-only)
+// RUN: %clang_cl \
+// RUN: --driver-mode=cl \
+// RUN: -ferror-limit=10 \
+// RUN: -fmsc-version=1800 \
+// RUN: -fno-strict-aliasing \
+// RUN: -fstrict-aliasing \
+// RUN: -mllvm -disable-llvm-optzns \
+// RUN: -Wunused-variables \
+// RUN: /Zs -- %s 2>&1
+
+
+void f() { }