diff --git a/llvm/lib/Support/Windows/Program.inc b/llvm/lib/Support/Windows/Program.inc --- a/llvm/lib/Support/Windows/Program.inc +++ b/llvm/lib/Support/Windows/Program.inc @@ -532,8 +532,13 @@ bool llvm::sys::commandLineFitsWithinSystemLimits(StringRef Program, ArrayRef Args) { - // The documented max length of the command line passed to CreateProcess. - static const size_t MaxCommandStringLength = 32768; + // In the documentation on CreateProcessW: + // https://docs.microsoft.com/en-us/windows/win32/api/processthreadsapi/nf-processthreadsapi-createprocessw + // it is stated that the argument lpCommandLine has restriction: + // + // The maximum length of this string is 32,767 characters, including the + // Unicode terminating null character. + static const size_t MaxCommandStringLength = 32767; SmallVector FullArgs; FullArgs.push_back(Program); FullArgs.append(Args.begin(), Args.end());