llvm/unittests/Option
Brian Gesiak 8fa6fcaf5a [Option] Fix PR37006 prefix choice in findNearest
Summary:
In https://bugs.llvm.org/show_bug.cgi?id=37006 Nico Weber points out a
flaw in `OptTable::findNearest`: if an option "foo"'s prefixes are "--"
and "-", then the nearest option for "--fob" will be "-foo". This is
incorrect, however, since the function is expected to return "--foo".

The bug is due to a naive loop that attempts to predetermines which
prefix is best. Instead, compute the edit distance for each prefix/name
pair.

Test Plan: `check-llvm`

Reviewers: thakis

Reviewed By: thakis

Subscribers: llvm-commits

Differential Revision: https://reviews.llvm.org/D46776

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@332299 91177308-0d34-0410-b5e6-96231b3b80d8
2018-05-14 21:35:00 +00:00
..
CMakeLists.txt [CMake] Also OptionTests can be free from add_dependencies() with add_public_tablegen_target(). 2013-11-28 17:04:13 +00:00
OptionParsingTest.cpp [Option] Fix PR37006 prefix choice in findNearest 2018-05-14 21:35:00 +00:00
Opts.td [Option] Fix PR37006 prefix choice in findNearest 2018-05-14 21:35:00 +00:00