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 | 9b1311df26041d76129d933f7eec796f559b88c9 (patch) | |
tree | b1b32d2b7cec2d43472acd4169d4258702812c4c /clang/lib/Driver/Compilation.cpp | |
parent | 78181b4b459bade43702de2c0c771f6be1f7e865 (diff) | |
download | llvm-9b1311df26041d76129d933f7eec796f559b88c9.zip llvm-9b1311df26041d76129d933f7eec796f559b88c9.tar.gz llvm-9b1311df26041d76129d933f7eec796f559b88c9.tar.bz2 |
[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
llvm-svn: 141202
Diffstat (limited to 'clang/lib/Driver/Compilation.cpp')
-rw-r--r-- | clang/lib/Driver/Compilation.cpp | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/clang/lib/Driver/Compilation.cpp b/clang/lib/Driver/Compilation.cpp index 85a5fc9..7a62fa4 100644 --- a/clang/lib/Driver/Compilation.cpp +++ b/clang/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; } |