Driver: Add Arg::getAsString and use when dumping arguments to
diagnostics.
 - This ensures that the whole argument and values are printed,
   instead of just the option name.

llvm-svn: 67366
diff --git a/clang/lib/Driver/Arg.cpp b/clang/lib/Driver/Arg.cpp
index eba39dd..c43c9fb 100644
--- a/clang/lib/Driver/Arg.cpp
+++ b/clang/lib/Driver/Arg.cpp
@@ -50,6 +50,22 @@
   llvm::errs() << ">\n";
 }
 
+std::string Arg::getAsString(const ArgList &Args) const {
+  std::string Res;
+  llvm::raw_string_ostream OS(Res);
+
+  ArgStringList ASL;
+  render(Args, ASL);
+  for (ArgStringList::iterator 
+         it = ASL.begin(), ie = ASL.end(); it != ie; ++it) {
+    if (it != ASL.begin())
+      OS << ' ';
+    OS << *it;
+  }
+
+  return OS.str();
+}
+
 void Arg::renderAsInput(const ArgList &Args, ArgStringList &Output) const {
   if (!getOption().hasNoOptAsInput()) {
     render(Args, Output);