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
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)) {
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;
}