[Windows] Fix limit on command line size
authorSerge Pavlov <sepavloff@gmail.com>
Tue, 14 Jul 2020 10:57:04 +0000 (17:57 +0700)
committerSerge Pavlov <sepavloff@gmail.com>
Thu, 23 Jul 2020 04:39:42 +0000 (11:39 +0700)
commitdab898f9ab62275f55eb2a7e76ea0cd01696f68e
tree19c839031d1e3804d801c70def9a763b3126859e
parent557db6f8aa56dd14803a65aae443d8019b4dcdde
[Windows] Fix limit on command line size

This reapplies commit d4020ef7c474, reverted in ac0edc55887b because it
broke build of LLDB. This commit contains appropriate changes for LLDB.
The original commit message is below.

Documentation on CreateProcessW states that maximal size of command line
is 32767 characters including ternimation null character. In the
function llvm::sys::commandLineFitsWithinSystemLimits this limit was set
to 32768. As a result if command line was exactly 32768 characters long,
a response file was not created and CreateProcessW was called with
too long command line.

Differential Revision: https://reviews.llvm.org/D83772
lldb/source/Host/windows/ProcessLauncherWindows.cpp
llvm/include/llvm/Support/Program.h
llvm/lib/Support/Windows/Program.inc
llvm/unittests/Support/CommandLineTest.cpp