diff options
author | Adrian McCarthy <amccarth@google.com> | 2020-05-27 13:53:47 -0700 |
---|---|---|
committer | Adrian McCarthy <amccarth@google.com> | 2020-05-27 14:49:30 -0700 |
commit | 2d068e534f1671459e1b135852c1b3c10502e929 (patch) | |
tree | 17b5c0215ff0a9d37a4021559b6e862e6ef1c9e4 /llvm/lib/Support/CommandLine.cpp | |
parent | 0a072b8a0da7399eeeb670330b7baeddf1bb407a (diff) | |
download | llvm-2d068e534f1671459e1b135852c1b3c10502e929.zip llvm-2d068e534f1671459e1b135852c1b3c10502e929.tar.gz llvm-2d068e534f1671459e1b135852c1b3c10502e929.tar.bz2 |
Fix Windows command line bug when last token in response file is ""
Patch by Neil Dhar <dhar@alumni.duke.edu>
Current state machine for parsing tokens from response files in Windows
does not correctly handle the case where the last token is "". The current
implementation handles the last token by only adding it if it is not empty,
however this does not cover the case where the last token is meant to be
the empty string. We can cover this case by checking whether the state
machine was last in the UNQUOTED state, which indicates that the last
character of the input was a non-whitespace character.
Differential Revision: https://reviews.llvm.org/D78346
Diffstat (limited to 'llvm/lib/Support/CommandLine.cpp')
-rw-r--r-- | llvm/lib/Support/CommandLine.cpp | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/llvm/lib/Support/CommandLine.cpp b/llvm/lib/Support/CommandLine.cpp index aa7e796..25612b7e 100644 --- a/llvm/lib/Support/CommandLine.cpp +++ b/llvm/lib/Support/CommandLine.cpp @@ -1009,7 +1009,7 @@ tokenizeWindowsCommandLineImpl(StringRef Src, StringSaver &Saver, } } - if (!Token.empty()) + if (State == UNQUOTED) AddToken(Saver.save(Token.str())); } |