aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--include/clang/Driver/Arg.h6
-rw-r--r--include/clang/Driver/Options.def4
-rw-r--r--lib/Driver/Arg.cpp10
3 files changed, 18 insertions, 2 deletions
diff --git a/include/clang/Driver/Arg.h b/include/clang/Driver/Arg.h
index 6d4cea81e3..30bb56ad77 100644
--- a/include/clang/Driver/Arg.h
+++ b/include/clang/Driver/Arg.h
@@ -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;
diff --git a/include/clang/Driver/Options.def b/include/clang/Driver/Options.def
index 66818e3e01..0819200613 100644
--- a/include/clang/Driver/Options.def
+++ b/include/clang/Driver/Options.def
@@ -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)
diff --git a/lib/Driver/Arg.cpp b/lib/Driver/Arg.cpp
index fa8e233fcd..eba39dd4f4 100644
--- a/lib/Driver/Arg.cpp
+++ b/lib/Driver/Arg.cpp
@@ -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) {
}