r194837 - clang-cl: Make the driver parse all(?) msvc flags

Hans Wennborg hans at hanshq.net
Fri Nov 15 10:29:58 PST 2013


Author: hans
Date: Fri Nov 15 12:29:58 2013
New Revision: 194837

URL: http://llvm.org/viewvc/llvm-project?rev=194837&view=rev
Log:
clang-cl: Make the driver parse all(?) msvc flags

Even if we don't support a flag, we should be able to parse it
to provide a better error message than the current default
"error: no such file or directory: '/foo'" (which we should probably
also tweak, btw).

This also tries to clean up the test file a bit.

Modified:
    cfe/trunk/include/clang/Driver/CLCompatOptions.td
    cfe/trunk/test/Driver/cl-options.c

Modified: cfe/trunk/include/clang/Driver/CLCompatOptions.td
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Driver/CLCompatOptions.td?rev=194837&r1=194836&r2=194837&view=diff
==============================================================================
--- cfe/trunk/include/clang/Driver/CLCompatOptions.td (original)
+++ cfe/trunk/include/clang/Driver/CLCompatOptions.td Fri Nov 15 12:29:58 2013
@@ -52,6 +52,8 @@ class CLRemainingArgs<string name> : Opt
 // (We don't put any of these in cl_compile_Group as the options they alias are
 // already in the right group.)
 
+def _SLASH_C : CLFlag<"C">, HelpText<"Don't discard comments when preprocessing">,
+  Alias<C>;
 def _SLASH_c : CLFlag<"c">, HelpText<"Compile only">, Alias<c>;
 def _SLASH_D : CLJoinedOrSeparate<"D">, HelpText<"Define macro">,
   MetaVarName<"<macro[=value]>">, Alias<D>;
@@ -61,6 +63,7 @@ def _SLASH_GF_ : CLFlag<"GF-">, HelpText
   Alias<fwritable_strings>;
 def _SLASH_help : CLFlag<"help">, Alias<help>,
   HelpText<"Display available options">;
+def _SLASH_HELP : CLFlag<"HELP">, Alias<help>;
 def _SLASH_I : CLJoinedOrSeparate<"I">,
   HelpText<"Add directory to include search path">, MetaVarName<"<dir>">,
   Alias<I>;
@@ -154,6 +157,7 @@ def _SLASH_errorReport : CLIgnoredJoined
 def _SLASH_FS : CLIgnoredFlag<"FS">, HelpText<"Force synchronous PDB writes">;
 def _SLASH_GF : CLIgnoredFlag<"GF">;
 def _SLASH_GS_ : CLIgnoredFlag<"GS-">;
+def _SLASH_kernel_ : CLIgnoredFlag<"kernel-">;
 def _SLASH_nologo : CLIgnoredFlag<"nologo">;
 def _SLASH_Ob1 : CLIgnoredFlag<"Ob1">;
 def _SLASH_Ob2 : CLIgnoredFlag<"Ob2">;
@@ -169,32 +173,83 @@ def _SLASH_Zm : CLIgnoredJoined<"Zm">;
 
 // Unsupported:
 
+def _SLASH_AI : CLJoined<"AI">;
 def _SLASH_arch : CLJoined<"arch:">;
 def _SLASH_bigobj : CLFlag<"bigobj">;
+def _SLASH_clr : CLJoined<"clr">;
+def _SLASH_doc : CLJoined<"doc">;
+def _SLASH_E : CLFlag<"E">;
 def _SLASH_EH : CLJoined<"EH">;
+def _SLASH_EP : CLFlag<"EP">;
 def _SLASH_FA_joined : CLJoined<"FA">;
+def _SLASH_favor : CLJoined<"favor">;
+def _SLASH_FC : CLFlag<"FC">;
+def _SLASH_F : CLFlag<"F">;
 def _SLASH_Fd : CLJoined<"Fd">;
-def _SLASH_Fp : CLJoined<"Fp">;
+def _SLASH_Fi : CLJoined<"Fi">;
+def _SLASH_Fm : CLJoined<"Fm">;
 def _SLASH_fp : CLJoined<"fp">;
+def _SLASH_Fp : CLJoined<"Fp">;
+def _SLASH_Fr : CLJoined<"Fr">;
+def _SLASH_FR : CLJoined<"FR">;
+def _SLASH_FU : CLJoinedOrSeparate<"FU">;
+def _SLASH_Fx : CLFlag<"Fx">;
+def _SLASH_G1 : CLFlag<"G1">;
+def _SLASH_G2 : CLFlag<"G2">;
+def _SLASH_GA : CLFlag<"GA">;
 def _SLASH_Gd : CLFlag<"Gd">;
+def _SLASH_Ge : CLFlag<"Ge">;
+def _SLASH_Gh : CLFlag<"Gh">;
+def _SLASH_GH : CLFlag<"GH">;
 def _SLASH_GL : CLFlag<"GL">;
 def _SLASH_GL_ : CLFlag<"GL-">;
 def _SLASH_Gm : CLFlag<"Gm">;
 def _SLASH_Gm_ : CLFlag<"Gm-">;
+def _SLASH_Gr : CLFlag<"Gr">;
 def _SLASH_GS : CLFlag<"GS">;
+def _SLASH_Gs : CLJoined<"Gs">;
 def _SLASH_GT : CLFlag<"GT">;
+def _SLASH_GX : CLFlag<"GX">;
 def _SLASH_Gy : CLFlag<"Gy">;
 def _SLASH_Gy_ : CLFlag<"Gy-">;
+def _SLASH_Gz : CLFlag<"Gz">;
 def _SLASH_GZ : CLFlag<"GZ">;
+def _SLASH_H : CLFlag<"H">;
+def _SLASH_homeparams : CLFlag<"homeparams">;
+def _SLASH_hotpatch : CLFlag<"hotpatch">;
+def _SLASH_kernel : CLFlag<"kernel">;
+def _SLASH_LN : CLFlag<"LN">;
 def _SLASH_MP : CLJoined<"MP">;
 def _SLASH_o : CLJoinedOrSeparate<"o">;
+def _SLASH_openmp : CLFlag<"openmp">;
+def _SLASH_Qfast_transcendentals : CLFlag<"Qfast_transcendentals">;
+def _SLASH_QIfist : CLFlag<"QIfist">;
+def _SLASH_Qimprecise_fwaits : CLFlag<"Qimprecise_fwaits">;
+def _SLASH_Qpar : CLFlag<"Qpar">;
+def _SLASH_Qvec_report : CLJoined<"Qvec-report">;
+def _SLASH_u : CLFlag<"u">;
+def _SLASH_V : CLFlag<"V">;
+def _SLASH_vd : CLJoined<"vd">;
 def _SLASH_vmb : CLFlag<"vmb">;
 def _SLASH_vmm : CLFlag<"vmm">;
 def _SLASH_vms : CLFlag<"vms">;
 def _SLASH_vmv : CLFlag<"vmv">;
+def _SLASH_volatile : CLFlag<"volatile">;
+def _SLASH_WL : CLFlag<"WL">;
+def _SLASH_Wp64 : CLFlag<"Wp64">;
+def _SLASH_X : CLFlag<"X">;
 def _SLASH_Yc : CLJoined<"Yc">;
+def _SLASH_Y_ : CLFlag<"Y-">;
+def _SLASH_Yd : CLFlag<"Yd">;
+def _SLASH_Yl : CLJoined<"Yl">;
 def _SLASH_Yu : CLJoined<"Yu">;
+def _SLASH_Z7 : CLFlag<"Z7">;
 def _SLASH_Za : CLFlag<"Za">;
 def _SLASH_Zc : CLJoined<"Zc:">;
-def _SLASH_ZI : CLFlag<"ZI">;
+def _SLASH_Ze : CLFlag<"Ze">;
+def _SLASH_Zg : CLFlag<"Zg">;
 def _SLASH_Zi : CLFlag<"Zi">;
+def _SLASH_ZI : CLFlag<"ZI">;
+def _SLASH_Zl : CLFlag<"Zl">;
+def _SLASH_Zp : CLFlag<"Zp">;
+def _SLASH_ZW : CLJoined<"ZW">;

Modified: cfe/trunk/test/Driver/cl-options.c
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Driver/cl-options.c?rev=194837&r1=194836&r2=194837&view=diff
==============================================================================
--- cfe/trunk/test/Driver/cl-options.c (original)
+++ cfe/trunk/test/Driver/cl-options.c Fri Nov 15 12:29:58 2013
@@ -102,9 +102,25 @@
 
 // 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 /GS- -- %s
-// RUN: %clang_cl /Zs /WX /sdl /sdl- -- %s
+// RUN: %clang_cl /Zs /WX \
+// RUN:    /analyze- \
+// RUN:    /errorReport:foo \
+// RUN:    /FS \
+// RUN:    /GF \
+// RUN:    /GS- \
+// RUN:    /kernel- \
+// RUN:    /nologo \
+// RUN:    /Ob1 \
+// RUN:    /Ob2 \
+// RUN:    /RTC1 \
+// RUN:    /sdl \
+// RUN:    /sdl- \
+// RUN:    /vmg \
+// RUN:    /w12345 \
+// RUN:    /wd1234 \
+// RUN:    /Zc:forScope \
+// RUN:    /Zc:wchar_t \
+// RUN:    -- %s
 
 // Ignored options and compile-only options are ignored for link jobs.
 // RUN: touch %t.obj
@@ -117,17 +133,98 @@
 // RUN: %clang_cl /Abracadabra -Qunused-arguments -### -- %s 2>&1 | FileCheck -check-prefix=UNUSED %s
 // UNUSED-NOT: warning
 
-
 // Unsupported but parsed options. Check that we don't error on them.
 // (/Zs is for syntax-only)
-// RUN: %clang_cl /Zs /arch:sse2 /Ycstdafx.h /Yustdafx.h /FpDebug\main.pch -- %s 2>&1
-// RUN: %clang_cl /Zs /EHsc /Fdfoo /fp:precise /Gd /GL /GL- -- %s 2>&1
-// RUN: %clang_cl /Zs /Gm /Gm- /GS /Gy /Gy- /GT /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 /FA /FAc /FAs /FAu /Fafilename -- %s 2>&1
-
+// RUN: %clang_cl /Zs \
+// RUN:     /AIfoo \
+// RUN:     /arch:sse2 \
+// RUN:     /clr:pure \
+// RUN:     /docname \
+// RUN:     /E \
+// RUN:     /EHsc \
+// RUN:     /EP \
+// RUN:     /F \
+// RUN:     /FA \
+// RUN:     /FAc \
+// RUN:     /Fafilename \
+// RUN:     /FAs \
+// RUN:     /FAu \
+// RUN:     /favor:blend \
+// RUN:     /FC \
+// RUN:     /Fdfoo \
+// 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:     /Gs1000 \
+// RUN:     /GT \
+// RUN:     /GX \
+// RUN:     /Gy \
+// RUN:     /Gy- \
+// 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:     /vd2 \
+// RUN:     /vmb \
+// RUN:     /vmm \
+// RUN:     /vms \
+// RUN:     /vmv \
+// RUN:     /volatile \
+// 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:     /Zc:auto \
+// RUN:     /Zc:wchar_t- \
+// RUN:     /Ze \
+// RUN:     /Zg \
+// RUN:     /Zi \
+// RUN:     /ZI \
+// RUN:     /Zl \
+// RUN:     /Zp \
+// 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





More information about the cfe-commits mailing list