]> granicus.if.org Git - clang/commitdiff
Driver: Add Arg::renderAsInput; this is a messy area and something I
authorDaniel Dunbar <daniel@zuster.org>
Thu, 19 Mar 2009 07:22:40 +0000 (07:22 +0000)
committerDaniel Dunbar <daniel@zuster.org>
Thu, 19 Mar 2009 07:22:40 +0000 (07:22 +0000)
was hoping to clean up in the rewrite, but I don't see it yet.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@67291 91177308-0d34-0410-b5e6-96231b3b80d8

include/clang/Driver/Arg.h
include/clang/Driver/Options.def
lib/Driver/Arg.cpp

index 6d4cea81e39a5e92bb64bbba4c825b581ebd3b86..30bb56ad778c9b28c11eb82e273c1409f1d18171 100644 (file)
@@ -86,6 +86,12 @@ namespace driver {
     /// 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;
index 66818e3e0102d69e92e5cf474252eca1e84edf30..081920061361b0d002715dcba1404b80e35db647 100644 (file)
@@ -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("-Wa,", Wa_COMMA, CommaJoined, INVALID, INVALID, "", 0)
 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)
index fa8e233fcddf8073e383285e570bde15b08c72f3..eba39dd4f48ee9a0bef0f7f86cd4c865b43c7fc6 100644 (file)
@@ -50,6 +50,16 @@ void Arg::dump() const {
   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) {
 }