hintonda created this revision.
hintonda added a subscriber: cfe-commits.

Add -Wc,<arg> option (similar to -Wl,<arg>) to go along with -Xclang.  This 
makes it easier to pass multiple options to cc1.

http://reviews.llvm.org/D13229

Files:
  include/clang/Driver/Options.td
  lib/Driver/Tools.cpp

Index: lib/Driver/Tools.cpp
===================================================================
--- lib/Driver/Tools.cpp
+++ lib/Driver/Tools.cpp
@@ -5080,9 +5080,9 @@
     A->claim();
   }
 
-  // Forward -Xclang arguments to -cc1, and -mllvm arguments to the LLVM option
-  // parser.
-  Args.AddAllArgValues(CmdArgs, options::OPT_Xclang);
+  // Forward -Xclang, and -Wc, arguments to -cc1, and -mllvm arguments to the
+  // LLVM option parser.
+  Args.AddAllArgValues(CmdArgs, options::OPT_Xclang, options::OPT_Wc_COMMA);
   for (const Arg *A : Args.filtered(options::OPT_mllvm)) {
     A->claim();
 
Index: include/clang/Driver/Options.td
===================================================================
--- include/clang/Driver/Options.td
+++ include/clang/Driver/Options.td
@@ -298,6 +298,9 @@
 def Wdeprecated : Flag<["-"], "Wdeprecated">, Group<W_Group>, 
Flags<[CC1Option]>;
 def Wno_deprecated : Flag<["-"], "Wno-deprecated">, Group<W_Group>, 
Flags<[CC1Option]>;
 def Wextra : Flag<["-"], "Wextra">, Group<W_Group>, Flags<[CC1Option]>;
+def Wc_COMMA : CommaJoined<["-"], "Wc,">, Flags<[DriverOption, CoreOption]>,
+  HelpText<"Pass the comma separated arguments in <arg> to the clang 
compiler">,
+  MetaVarName<"<arg>">;
 def Wl_COMMA : CommaJoined<["-"], "Wl,">, Flags<[LinkerInput, RenderAsInput]>,
   HelpText<"Pass the comma separated arguments in <arg> to the linker">,
   MetaVarName<"<arg>">;


Index: lib/Driver/Tools.cpp
===================================================================
--- lib/Driver/Tools.cpp
+++ lib/Driver/Tools.cpp
@@ -5080,9 +5080,9 @@
     A->claim();
   }
 
-  // Forward -Xclang arguments to -cc1, and -mllvm arguments to the LLVM option
-  // parser.
-  Args.AddAllArgValues(CmdArgs, options::OPT_Xclang);
+  // Forward -Xclang, and -Wc, arguments to -cc1, and -mllvm arguments to the
+  // LLVM option parser.
+  Args.AddAllArgValues(CmdArgs, options::OPT_Xclang, options::OPT_Wc_COMMA);
   for (const Arg *A : Args.filtered(options::OPT_mllvm)) {
     A->claim();
 
Index: include/clang/Driver/Options.td
===================================================================
--- include/clang/Driver/Options.td
+++ include/clang/Driver/Options.td
@@ -298,6 +298,9 @@
 def Wdeprecated : Flag<["-"], "Wdeprecated">, Group<W_Group>, Flags<[CC1Option]>;
 def Wno_deprecated : Flag<["-"], "Wno-deprecated">, Group<W_Group>, Flags<[CC1Option]>;
 def Wextra : Flag<["-"], "Wextra">, Group<W_Group>, Flags<[CC1Option]>;
+def Wc_COMMA : CommaJoined<["-"], "Wc,">, Flags<[DriverOption, CoreOption]>,
+  HelpText<"Pass the comma separated arguments in <arg> to the clang compiler">,
+  MetaVarName<"<arg>">;
 def Wl_COMMA : CommaJoined<["-"], "Wl,">, Flags<[LinkerInput, RenderAsInput]>,
   HelpText<"Pass the comma separated arguments in <arg> to the linker">,
   MetaVarName<"<arg>">;
_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to