[PATCH] D41732: [Option] Add 'findNearest' method to catch typos
Jonathan Roelofs via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Fri Jan 5 04:10:59 PST 2018
jroelofs added inline comments.
================
Comment at: lib/Option/OptTable.cpp:280
+ // "--helm", suggest "--help" over "-help".
+ StringRef Prefix;
+ for (int P = 0; CandidateInfo.Prefixes[P]; P++) {
----------------
ruiu wrote:
> I wonder why you chose to use the prefix matching instead of edit distance. Conveniently, StringRef has edit_distance function, so you can use that if you want.
+1
================
Comment at: lib/Option/OptTable.cpp:308
+ if (RHS.empty())
+ NearestString = (Prefix + CandidateName).str();
+ else
----------------
These are the same whether RHS is empty or not.
https://reviews.llvm.org/D41732
More information about the llvm-commits
mailing list