[cfe-commits] r67291 - in /cfe/trunk: include/clang/Driver/Arg.h include/clang/Driver/Options.def lib/Driver/Arg.cpp

Daniel Dunbar daniel at zuster.org
Thu Mar 19 00:22:41 PDT 2009


Author: ddunbar
Date: Thu Mar 19 02:22:40 2009
New Revision: 67291

URL: http://llvm.org/viewvc/llvm-project?rev=67291&view=rev
Log:
Driver: Add Arg::renderAsInput; this is a messy area and something I
was hoping to clean up in the rewrite, but I don't see it yet.

Modified:
    cfe/trunk/include/clang/Driver/Arg.h
    cfe/trunk/include/clang/Driver/Options.def
    cfe/trunk/lib/Driver/Arg.cpp

Modified: cfe/trunk/include/clang/Driver/Arg.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Driver/Arg.h?rev=67291&r1=67290&r2=67291&view=diff

==============================================================================
--- cfe/trunk/include/clang/Driver/Arg.h (original)
+++ cfe/trunk/include/clang/Driver/Arg.h Thu Mar 19 02:22:40 2009
@@ -86,6 +86,12 @@
     /// render - Append the argument onto the given array as strings.
     virtual void render(const ArgList &Args, ArgStringList &Output) const = 0;
 
+    /// renderAsInput - Append the argument, render as an input, onto
+    /// the given array as strings. The distinction is that some
+    /// options only render their values when rendered as a input
+    /// (e.g., Xlinker).
+    void renderAsInput(const ArgList &Args, ArgStringList &Output) const;
+
     static bool classof(const Arg *) { return true; }    
 
     void dump() const;

Modified: cfe/trunk/include/clang/Driver/Options.def
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Driver/Options.def?rev=67291&r1=67290&r2=67291&view=diff

==============================================================================
--- cfe/trunk/include/clang/Driver/Options.def (original)
+++ cfe/trunk/include/clang/Driver/Options.def Thu Mar 19 02:22:40 2009
@@ -52,7 +52,7 @@
 //     gcc.
 //
 //  i: The option should not render the name when rendered as an
-//     input.
+//     input (i.e., the option is rendered as values).
 //
 //  l: The option is a linker input.
 //
@@ -258,7 +258,7 @@
 OPTION("-Wall", Wall, Flag, W_Group, INVALID, "", 0)
 OPTION("-Wfloat-equal", Wfloat_equal, Flag, clang_W_Group, INVALID, "", 0)
 OPTION("-Wimplicit-function-declaration", Wimplicit_function_declaration, Flag, clang_W_Group, INVALID, "", 0)
-OPTION("-Wl,", Wl_COMMA, CommaJoined, INVALID, INVALID, "l", 0)
+OPTION("-Wl,", Wl_COMMA, CommaJoined, INVALID, INVALID, "li", 0)
 OPTION("-Wno-format-nonliteral", Wno_format_nonliteral, Flag, clang_W_Group, INVALID, "", 0)
 OPTION("-Wno-nonportable-cfstrings", Wno_nonportable_cfstrings, Joined, W_Group, INVALID, "", 0)
 OPTION("-Wno-strict-selector-match", Wno_strict_selector_match, Flag, clang_W_Group, INVALID, "", 0)

Modified: cfe/trunk/lib/Driver/Arg.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Driver/Arg.cpp?rev=67291&r1=67290&r2=67291&view=diff

==============================================================================
--- cfe/trunk/lib/Driver/Arg.cpp (original)
+++ cfe/trunk/lib/Driver/Arg.cpp Thu Mar 19 02:22:40 2009
@@ -50,6 +50,16 @@
   llvm::errs() << ">\n";
 }
 
+void Arg::renderAsInput(const ArgList &Args, ArgStringList &Output) const {
+  if (!getOption().hasNoOptAsInput()) {
+    render(Args, Output);
+    return;
+  }
+
+  for (unsigned i = 0, e = getNumValues(); i != e; ++i)
+    Output.push_back(getValue(Args, i));
+}
+
 FlagArg::FlagArg(const Option *Opt, unsigned Index)
   : Arg(FlagClass, Opt, Index) {
 }





More information about the cfe-commits mailing list