def cl_Group : OptionGroup<"<clang-cl options>">,
HelpText<"CL.EXE COMPATIBILITY OPTIONS">;
+def cl_ignored_Group : OptionGroup<"<clang-cl ignored options>">,
+ Group<cl_Group>;
+
class CLFlag<string name> : Option<["/", "-"], name, KIND_FLAG>,
Group<cl_Group>, Flags<[CLOption, DriverOption]>;
-def _QUESTION : CLFlag<"?">, Alias<help>, HelpText<"Display available options">;
+class CLIgnoredFlag<string name> : Option<["/", "-"], name, KIND_FLAG>,
+ Group<cl_ignored_Group>, Flags<[CLOption, DriverOption]>;
+
+class CLJoined<string name> : Option<["/", "-"], name, KIND_JOINED>,
+ Group<cl_Group>, Flags<[CLOption, DriverOption]>;
+
+class CLIgnoredJoined<string name> : Option<["/", "-"], name, KIND_JOINED>,
+ Group<cl_ignored_Group>, Flags<[CLOption, DriverOption]>;
+
+class CLJoinedOrSeparate<string name> : Option<["/", "-"], name,
+ KIND_JOINED_OR_SEPARATE>, Group<cl_Group>, Flags<[CLOption, DriverOption]>;
+
+// Aliases:
+
def _SLASH_c : CLFlag<"c">, HelpText<"Compile only">, Alias<c>;
+def _SLASH_D : CLJoinedOrSeparate<"D">, HelpText<"Define macro">,
+ MetaVarName<"<macro[=value]>">, Alias<D>;
+def _SLASH_GR : CLFlag<"GR">, HelpText<"Enable RTTI">, Alias<frtti>;
+def _SLASH_GR_ : CLFlag<"GR-">, HelpText<"Disable RTTI">, Alias<fno_rtti>;
def _SLASH_help : CLFlag<"help">, Alias<help>,
HelpText<"Display available options">;
+def _SLASH_I : CLJoinedOrSeparate<"I">,
+ HelpText<"Add directory to include search path">, MetaVarName<"<dir>">,
+ Alias<I>;
+def _SLASH_J : CLFlag<"J">, HelpText<"Make char type unsigned">,
+ Alias<funsigned_char>;
+def _SLASH_O : CLJoined<"O">, HelpText<"Optimization level">,
+ MetaVarName<"<n>">, Alias<O>;
+def _SLASH_Ob0 : CLFlag<"Ob0">, HelpText<"Disable inlining">,
+ Alias<fno_inline>;
+def _SLASH_Od : CLFlag<"Od">, HelpText<"Disable optimization">, Alias<O0>;
+def _SLASH_Os : CLFlag<"Os">, HelpText<"Optimize for size">, Alias<O>,
+ AliasArgs<["s"]>;
+def _SLASH_Ot : CLFlag<"Ot">, HelpText<"Optimize for speed">, Alias<O>,
+ AliasArgs<["2"]>;
+def _SLASH_Ox : CLFlag<"Ox">, HelpText<"Maximum optimization">, Alias<O>,
+ AliasArgs<["3"]>;
+def _SLASH_Oy : CLFlag<"Oy">, HelpText<"Enable frame pointer omission">,
+ Alias<fomit_frame_pointer>;
+def _SLASH_Oy_ : CLFlag<"Oy-">, HelpText<"Disable frame pointer omission">,
+ Alias<fno_omit_frame_pointer>;
+def _SLASH_P : CLFlag<"P">, HelpText<"Only run the preprocessor">, Alias<E>;
+def _SLASH_QUESTION : CLFlag<"?">, Alias<help>,
+ HelpText<"Display available options">;
+def _SLASH_U : CLJoinedOrSeparate<"U">, HelpText<"Undefine macro">,
+ MetaVarName<"<macro>">, Alias<U>;
def _SLASH_W0 : CLFlag<"W0">, HelpText<"Disable all warnings">, Alias<w>;
def _SLASH_W1 : CLFlag<"W1">, HelpText<"Enable -Wall">, Alias<Wall>;
+def _SLASH_W2 : CLFlag<"W2">, HelpText<"Enable -Wall">, Alias<Wall>;
+def _SLASH_W3 : CLFlag<"W3">, HelpText<"Enable -Wall">, Alias<Wall>;
+def _SLASH_W4 : CLFlag<"W4">, HelpText<"Enable -Wall">, Alias<Wall>;
+def _SLASH_Wall : CLFlag<"Wall">, HelpText<"Enable -Wall">, Alias<Wall>;
+def _SLASH_WX : CLFlag<"WX">, HelpText<"Treat warnings as errors">,
+ Alias<W_Joined>, AliasArgs<["error"]>;
+def _SLASH_WX_ : CLFlag<"WX-">, HelpText<"Do not treat warnings as errors">,
+ Alias<W_Joined>, AliasArgs<["no-error"]>;
+def _SLASH_w_flag : CLFlag<"w">, HelpText<"Disable all warnings">, Alias<w>;
+def _SLASH_Zs : CLFlag<"Zs">, HelpText<"Syntax-check only">,
+ Alias<fsyntax_only>;
+
+
+// Ignored:
+
+def _SLASH_analyze_ : CLIgnoredFlag<"analyze-">;
+def _SLASH_errorReport : CLIgnoredJoined<"errorReport">;
+def _SLASH_nologo : CLIgnoredFlag<"nologo">;
+def _SLASH_Ob1 : CLIgnoredFlag<"Ob1">;
+def _SLASH_Ob2 : CLIgnoredFlag<"Ob2">;
+def _SLASH_Zc_forScope : CLIgnoredFlag<"Zc:forScope">;
+def _SLASH_Zc_wchar_t : CLIgnoredFlag<"Zc:wchar_t">;
+
+
+// Unsupported:
+
+def _SLASH_EH : CLJoined<"EH">;
+def _SLASH_Fd : CLJoined<"Fd">;
+def _SLASH_Fo : CLJoined<"Fo">;
+def _SLASH_fp : CLJoined<"fp">;
+def _SLASH_Gd : CLFlag<"Gd">;
+def _SLASH_GL : CLFlag<"GL">;
+def _SLASH_GL_ : CLFlag<"GL-">;
+def _SLASH_Gm : CLFlag<"Gm">;
+def _SLASH_Gm_ : CLFlag<"Gm-">;
+def _SLASH_GS : CLFlag<"GS">;
+def _SLASH_Gy : CLFlag<"Gy">;
+def _SLASH_Gy_ : CLFlag<"Gy-">;
+def _SLASH_GZ : CLFlag<"GZ">;
+def _SLASH_MD : CLFlag<"MD">;
+def _SLASH_MT : CLFlag<"MT">;
+def _SLASH_MDd : CLFlag<"MDd">;
+def _SLASH_MTd : CLFlag<"MTd">;
+def _SLASH_Oi : CLFlag<"Oi">;
+def _SLASH_RTC : CLJoined<"RTC">;
+def _SLASH_showIncludes : CLJoined<"showIncludes">;
+def _SLASH_Tc : CLJoined<"Tc">;
+def _SLASH_TC : CLFlag<"TC">;
+def _SLASH_Tp : CLJoined<"Tp">;
+def _SLASH_TP : CLFlag<"TP">;
+def _SLASH_w : CLJoined<"w">;
+def _SLASH_Zc : CLJoined<"Zc:">;
+def _SLASH_ZI : CLFlag<"ZI">;
+def _SLASH_Zi : CLFlag<"Zi">;
// Don't attempt slash switches on msys bash.
// REQUIRES: shell-preserves-root
-// RUN: %clang_cl /c /W0 %s -### 2>&1 | FileCheck -check-prefix=W0 %s
-// W0-DAG: -c
-// W0-DAG: -w
-// RUN: %clang_cl /c /W1 %s -### 2>&1 | FileCheck -check-prefix=W1 %s
-// W1-DAG: -c
-// W1-DAG: -Wall
+// Alias options:
+
+// RUN: %clang_cl /c %s -### 2>&1 | FileCheck -check-prefix=C %s
+// C: -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"
+
+// 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 /J %s -### 2>&1 | FileCheck -check-prefix=J %s
+// J: -fno-signed-char
+
+// RUN: %clang_cl /Ofoo %s -### 2>&1 | FileCheck -check-prefix=O %s
+// O: -Ofoo
+
+// RUN: %clang_cl /Ob0 %s -### 2>&1 | FileCheck -check-prefix=Ob0 %s
+// Ob0: -fno-inline
+
+// RUN: %clang_cl /Od %s -### 2>&1 | FileCheck -check-prefix=Od %s
+// Od: -O0
+
+// RUN: %clang_cl /Os %s -### 2>&1 | FileCheck -check-prefix=Os %s
+// Os: -Os
+
+// RUN: %clang_cl /Ot %s -### 2>&1 | FileCheck -check-prefix=Ot %s
+// Ot: -O2
+
+// RUN: %clang_cl /Ox %s -### 2>&1 | FileCheck -check-prefix=Ox %s
+// Ox: -O3
+
+// RUN: %clang_cl /Zs /Oy %s 2>&1
+
+// 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 /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 /W0 %s -### 2>&1 | FileCheck -check-prefix=W0 %s
+// W0: -w
+
+// RUN: %clang_cl /W1 %s -### 2>&1 | FileCheck -check-prefix=W1 %s
+// RUN: %clang_cl /W2 %s -### 2>&1 | FileCheck -check-prefix=W1 %s
+// RUN: %clang_cl /W3 %s -### 2>&1 | FileCheck -check-prefix=W1 %s
+// RUN: %clang_cl /W4 %s -### 2>&1 | FileCheck -check-prefix=W1 %s
+// RUN: %clang_cl /Wall %s -### 2>&1 | FileCheck -check-prefix=W1 %s
+// W1: -Wall
+
+// RUN: %clang_cl /WX %s -### 2>&1 | FileCheck -check-prefix=WX %s
+// WX: -Werror
+
+// RUN: %clang_cl /WX- %s -### 2>&1 | FileCheck -check-prefix=WX_ %s
+// WX_: -Wno-error
+
+// RUN: %clang_cl /w %s -### 2>&1 | FileCheck -check-prefix=w %s
+// w: -w
+
+// RUN: %clang_cl /Zs %s -### 2>&1 | FileCheck -check-prefix=Zs %s
+// Zs: -fsyntax-only
+
+
+// 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 %s
+
+
+// Unsupported but parsed options. Check that we don't error on them.
+// (/Zs is for syntax-only)
+// RUN: %clang_cl /Zs /EHsc /Fdfoo /Fobar /fp:precise /Gd /GL /GL- /Gm %s 2>&1
+// RUN: %clang_cl /Zs /Gm- /GS /Gy /Gy- /GZ /MD /MT /MDd /MTd /Oi %s 2>&1
+// RUN: %clang_cl /Zs /RTC1 /Tcfoo /TC /Tpbar /TP /wfoo /Zc:wchar_t- /ZI %s 2>&1
+// RUN: %clang_cl /Zs /Zi /showIncludes %s 2>&1