summaryrefslogtreecommitdiffstats
path: root/llvm/lib/Support/Program.cpp
diff options
context:
space:
mode:
authorZachary Turner <zturner@google.com>2018-06-09 22:44:44 +0000
committerZachary Turner <zturner@google.com>2018-06-09 22:44:44 +0000
commit48c3341cfe47b5c4d0dca8fac80bfcf1ecaefb88 (patch)
treeb7009636fb500f384daed7a630ca91c107c71541 /llvm/lib/Support/Program.cpp
parent7ff6a8a3168afce70632d45aa3559e2cdeb348be (diff)
downloadbcm5719-llvm-48c3341cfe47b5c4d0dca8fac80bfcf1ecaefb88.tar.gz
bcm5719-llvm-48c3341cfe47b5c4d0dca8fac80bfcf1ecaefb88.zip
[Support] Expose flattenWindowsCommandLine.
This function was internal to Program.inc, but I've needed this on several occasions when I've had to use CreateProcess without llvm's sys::Execute functions. In doing so, I noticed that the function was written using unsafe C-string access and was pretty hard to understand / make sense of, so I've also re-written the functions to use more modern LLVM constructs. llvm-svn: 334353
Diffstat (limited to 'llvm/lib/Support/Program.cpp')
-rw-r--r--llvm/lib/Support/Program.cpp9
1 files changed, 9 insertions, 0 deletions
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<const char *> Args) {
+ SmallVector<StringRef, 8> 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"
OpenPOWER on IntegriCloud