forked from OSchip/llvm-project
Driver: Fix -### to quote shell special characters, following gcc.
llvm-svn: 99053
This commit is contained in:
parent
595ecbe5c4
commit
7c4de04c30
|
@ -61,10 +61,21 @@ void Compilation::PrintJob(llvm::raw_ostream &OS, const Job &J,
|
||||||
OS << " \"" << C->getExecutable() << '"';
|
OS << " \"" << C->getExecutable() << '"';
|
||||||
for (ArgStringList::const_iterator it = C->getArguments().begin(),
|
for (ArgStringList::const_iterator it = C->getArguments().begin(),
|
||||||
ie = C->getArguments().end(); it != ie; ++it) {
|
ie = C->getArguments().end(); it != ie; ++it) {
|
||||||
if (Quote)
|
OS << ' ';
|
||||||
OS << " \"" << *it << '"';
|
if (!Quote) {
|
||||||
else
|
OS << *it;
|
||||||
OS << ' ' << *it;
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Quote the argument and escape shell special characters; this isn't
|
||||||
|
// really complete but is good enough.
|
||||||
|
OS << '"';
|
||||||
|
for (const char *s = *it; *s; ++s) {
|
||||||
|
if (*s == '"' || *s == '\\' || *s == '$')
|
||||||
|
OS << '\\';
|
||||||
|
OS << *s;
|
||||||
|
}
|
||||||
|
OS << '"';
|
||||||
}
|
}
|
||||||
OS << Terminator;
|
OS << Terminator;
|
||||||
} else if (const PipedJob *PJ = dyn_cast<PipedJob>(&J)) {
|
} else if (const PipedJob *PJ = dyn_cast<PipedJob>(&J)) {
|
||||||
|
|
Loading…
Reference in New Issue