OSDN Git Service

Option spell checking: Penalize delimiter flags if input has no argument
authorNico Weber <nicolasweber@gmx.de>
Wed, 1 May 2019 16:45:15 +0000 (16:45 +0000)
committerNico Weber <nicolasweber@gmx.de>
Wed, 1 May 2019 16:45:15 +0000 (16:45 +0000)
commit24da1864838e8cd52d6e23f6e9bd6276bf942bca
treeed3625d0bb98a896393d7885e159a950e5f3d591
parent1c29f9f7f50aa984f55f74e8f4e0e25e39e6715f
Option spell checking: Penalize delimiter flags if input has no argument

If the user passes a flag like `-version` to a program, it's more likely
they mean `--version` than `-version:`, since there's no parameter
passed. Hence, give delimited arguments a penalty of 1 if the user input
doesn't contain the delimiter or no data after it.

The motivation is that with this, lld-link can suggest "--version"
instead of "-version:" for "-version" and "-nodefaultlib" instead of
"-nodefaultlib:" for "-nodefaultlibs".

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

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