[PATCH] D122914: [Windows] Fix handling of \" in program name on cmd line.

Hans Wennborg via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Apr 19 04:56:13 PDT 2022


hans accepted this revision.
hans added a comment.
This revision is now accepted and ready to land.

Looks good to me.



================
Comment at: llvm/lib/Support/CommandLine.cpp:1027-1028
 
   if (State == UNQUOTED)
     AddToken(Saver.save(Token.str()));
 }
----------------
simon_tatham wrote:
> rnk wrote:
> > This seems like it could be a bug when the command line ends with an open quoted string. We should match the CRT logic. In the original example, the entire command line would become argv[0].
> I thought the same, and I considered fixing it as part of the same commit – I would have expected that we'd add the current token if it had accumulated any text, whether the quotes had been closed or not. But the git history tells me that D78346 changed it from that to this, so I didn't want to unilaterally revert a previous deliberate change.
> 
> However, now I look more closely at that previous change, it looks as if it's not intentionally discarding any actual text – it's _preventing_ the discarding of an explicit empty-string token. So perhaps I can fix that after all without reverting the intended change. I think we ought to be testing `State != INIT`.
Perhaps this should be done in a separate commit?


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D122914/new/

https://reviews.llvm.org/D122914



More information about the llvm-commits mailing list