OSDN Git Service

Fix OptTable::findNearest() adding delimiter for free
authorNico Weber <nicolasweber@gmx.de>
Wed, 1 May 2019 14:46:17 +0000 (14:46 +0000)
committerNico Weber <nicolasweber@gmx.de>
Wed, 1 May 2019 14:46:17 +0000 (14:46 +0000)
commit28a57e37b20cedebd1adc5117eebf871c2c81731
treeb3e25b417be81759e61a188089e81196d6d91fe3
parentf880a637c4391dadf6903bd0b65675b1eb202995
Fix OptTable::findNearest() adding delimiter for free

Prior to this, OptTable::findNearest() thought that the input `--foo`
had an editing distance of 0 from an existing flag `--foo=`, which made
it suggest flags with delimiters more often than flags without one.
After this, it correctly assigns this case an editing distance of 1.

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@359685 91177308-0d34-0410-b5e6-96231b3b80d8
lib/Option/OptTable.cpp
unittests/Option/OptionParsingTest.cpp
unittests/Option/Opts.td