[PATCH] D41732: [Option] Add 'findNearest' method to catch typos

Rui Ueyama via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Jan 4 23:17:42 PST 2018


ruiu 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++) {
----------------
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.


https://reviews.llvm.org/D41732





More information about the llvm-commits mailing list