aboutsummaryrefslogtreecommitdiff
path: root/lib/Driver/Compilation.cpp
diff options
context:
space:
mode:
authorChad Rosier <mcrosier@apple.com>2011-10-05 19:51:41 +0000
committerChad Rosier <mcrosier@apple.com>2011-10-05 19:51:41 +0000
commita2dd7d08a3665ba75d3d17b06a0dcc11570c9575 (patch)
treec3abe0dc9763f7ea0fb029610457ef4c8ab3e563 /lib/Driver/Compilation.cpp
parenta1e797e7c0de5f4ac63ff902f22f457cc9360ba7 (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.cpp9
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;
}