[llvm] r341992 - [Support] Quote arguments containing \n on Windows

Reid Kleckner via llvm-commits llvm-commits at lists.llvm.org
Tue Sep 11 14:02:04 PDT 2018


Author: rnk
Date: Tue Sep 11 14:02:03 2018
New Revision: 341992

URL: http://llvm.org/viewvc/llvm-project?rev=341992&view=rev
Log:
[Support] Quote arguments containing \n on Windows

Fixes at_file.c test failure caused by r341988. We may want to change
how we treat \n in our tokenizer, but this is probably a good fix
regardless, since we can invoke all kinds of programs with different
interpretations of the command line quoting rules.

Modified:
    llvm/trunk/lib/Support/Windows/Program.inc

Modified: llvm/trunk/lib/Support/Windows/Program.inc
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Support/Windows/Program.inc?rev=341992&r1=341991&r2=341992&view=diff
==============================================================================
--- llvm/trunk/lib/Support/Windows/Program.inc (original)
+++ llvm/trunk/lib/Support/Windows/Program.inc Tue Sep 11 14:02:03 2018
@@ -317,7 +317,7 @@ static bool Execute(ProcessInfo &PI, Str
 static bool argNeedsQuotes(StringRef Arg) {
   if (Arg.empty())
     return true;
-  return StringRef::npos != Arg.find_first_of("\t \"&\'()*<>\\`^|");
+  return StringRef::npos != Arg.find_first_of("\t \"&\'()*<>\\`^|\n");
 }
 
 static std::string quoteSingleArg(StringRef Arg) {




More information about the llvm-commits mailing list