From 15243d5a6df3e2cd3e3386891a6338388029b256 Mon Sep 17 00:00:00 2001 From: Zachary Turner Date: Sun, 10 Jun 2018 20:57:14 +0000 Subject: Attempt 3: Resubmit "[Support] Expose flattenWindowsCommandLine." I took some liberties and quoted fewer characters than before, based on an article from MSDN which says that only certain characters cause an arg to require quoting. This seems to be incorrect, though, and worse it seems to be a difference in Windows version. The bot that fails is Windows 7, and I can't reproduce the failure on Win 10. But it's definitely related to quoting and special characters, because both tests that fail have a * in the argument, which is one of the special characters that would cause an argument to be quoted before but not any longer after the new patch. Since I don't have Win 7, all I can do is just guess that I need to restore the old quoting rules. So this patch does that in hopes that it fixes the problem on Windows 7. llvm-svn: 334375 --- llvm/lib/Support/Program.cpp | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'llvm/lib/Support/Program.cpp') diff --git a/llvm/lib/Support/Program.cpp b/llvm/lib/Support/Program.cpp index 8484b46e522..8c56fb6db2d 100644 --- a/llvm/lib/Support/Program.cpp +++ b/llvm/lib/Support/Program.cpp @@ -63,6 +63,15 @@ ProcessInfo sys::ExecuteNoWait(StringRef Program, const char **Args, return PI; } +bool sys::commandLineFitsWithinSystemLimits(StringRef Program, + ArrayRef Args) { + SmallVector StringRefArgs; + StringRefArgs.reserve(Args.size()); + for (const char *A : Args) + StringRefArgs.emplace_back(A); + return commandLineFitsWithinSystemLimits(Program, StringRefArgs); +} + // Include the platform-specific parts of this class. #ifdef LLVM_ON_UNIX #include "Unix/Program.inc" -- cgit v1.2.3