diff options
author | Chad Rosier <mcrosier@apple.com> | 2011-10-05 19:51:41 +0000 |
---|---|---|
committer | Chad Rosier <mcrosier@apple.com> | 2011-10-05 19:51:41 +0000 |
commit | a2dd7d08a3665ba75d3d17b06a0dcc11570c9575 (patch) | |
tree | c3abe0dc9763f7ea0fb029610457ef4c8ab3e563 /lib/Driver/Compilation.cpp | |
parent | a1e797e7c0de5f4ac63ff902f22f457cc9360ba7 (diff) |
[driver] The -v option doesn't quoted the command line arguments for historical
reasons. However, it does seems practical to quote strings that need it.
rdar://10221951
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@141202 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Driver/Compilation.cpp')
-rw-r--r-- | lib/Driver/Compilation.cpp | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/lib/Driver/Compilation.cpp b/lib/Driver/Compilation.cpp index 85a5fc9330..7a62fa4b55 100644 --- a/lib/Driver/Compilation.cpp +++ b/lib/Driver/Compilation.cpp @@ -70,6 +70,13 @@ const DerivedArgList &Compilation::getArgsForToolChain(const ToolChain *TC, return *Entry; } +static bool needsQuote(const char *s) { + for (const char *c = s; *c; ++c) + if (*c == ' ') + return true; + return false; +} + void Compilation::PrintJob(raw_ostream &OS, const Job &J, const char *Terminator, bool Quote) const { if (const Command *C = dyn_cast<Command>(&J)) { @@ -77,7 +84,7 @@ void Compilation::PrintJob(raw_ostream &OS, const Job &J, for (ArgStringList::const_iterator it = C->getArguments().begin(), ie = C->getArguments().end(); it != ie; ++it) { OS << ' '; - if (!Quote) { + if (!Quote && !needsQuote(*it)) { OS << *it; continue; } |