aboutsummaryrefslogtreecommitdiff
path: root/lib/Driver/Compilation.cpp
diff options
context:
space:
mode:
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;
}