This is an archive of the discontinued LLVM Phabricator instance.

Option spell checking: Penalize delimiter flags if input has no argument
ClosedPublic

Authored by thakis on May 1 2019, 8:12 AM.

Details

Summary

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".

Diff Detail

Repository
rL LLVM

Event Timeline

thakis created this revision.May 1 2019, 8:12 AM
Herald added a project: Restricted Project. · View Herald TranscriptMay 1 2019, 8:12 AM
Herald added a subscriber: hiraditya. · View Herald Transcript
MaskRay accepted this revision.May 1 2019, 8:35 AM
MaskRay added inline comments.
llvm/lib/Option/OptTable.cpp
311 ↗(On Diff #197556)

++Distance;

This revision is now accepted and ready to land.May 1 2019, 8:35 AM
thakis marked an inline comment as done.May 1 2019, 9:42 AM

Thanks! Landing with suggested tweak applied.

This revision was automatically updated to reflect the committed changes.