[PATCH] D41873: [Option] For typo '-foo', suggest '--foo'
Nico Weber via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Fri May 11 20:43:54 PDT 2018
thakis added inline comments.
================
Comment at: lib/Option/OptTable.cpp:281
+ StringRef Prefix = CandidateInfo.Prefixes[0];
+ for (int P = 1; CandidateInfo.Prefixes[P]; P++) {
if (Option.startswith(CandidateInfo.Prefixes[P]))
----------------
thakis wrote:
> This relies on '--' being later in Prefixes than '-'. If '--' is Prefixes[0] is -- and then Prefixes[1] is -, then Option.startswith (Prefixes[1]) is true and we switch from -- to - for flags that start with --.
>
> And -- being later in Prefixes isn't guaranteed.
(A fix for this is at https://reviews.llvm.org/D46776)
https://reviews.llvm.org/D41873
More information about the llvm-commits
mailing list