2017-07-18 10:18:19 +08:00
|
|
|
RUN: llvm-mt /h | FileCheck %s -check-prefix=HELP
|
2017-07-18 05:35:12 +08:00
|
|
|
|
|
|
|
HELP: OVERVIEW: Manifest Tool
|
2017-08-19 08:37:41 +08:00
|
|
|
|
|
|
|
RUN: not llvm-mt /foo 2>&1 >/dev/null | FileCheck %s -check-prefix=INVALID
|
2018-06-24 00:49:07 +08:00
|
|
|
INVALID: llvm-mt: error: invalid option '/foo'
|
[Option] Add 'findNearest' method to catch typos
Summary:
Add a method `OptTable::findNearest`, which allows users of OptTable to
check user input for misspelled options. In addition, have llvm-mt
check for misspelled options. For example, if a user invokes
`llvm-mt /oyt:foo`, the error message will indicate that while an
option named `/oyt:` does not exist, `/out:` does.
The method ports the functionality of the `LookupNearestOption` method
from LLVM CommandLine to libLLVMOption. This allows tools like Clang
and Swift, which do not use CommandLine, to use this functionality to
suggest similarly spelled options.
As room for future improvement, the new method as-is cannot yet properly suggest
nearby "joined" options -- that is, for an option string "-FozBar", where
"-Foo" is the correct option name and "Bar" is the value being passed along
with the misspelled option, this method will calculate an edit distance of 4,
by deleting "Bar" and changing "z" to "o". It should instead calculate an edit
distance of just 1, by changing "z" to "o" and recognizing "Bar" as a
value. This commit includes a disabled test that expresses this limitation.
Test Plan: `check-llvm`
Reviewers: yamaguchi, v.g.vassilev, teemperor, ruiu, jroelofs
Reviewed By: jroelofs
Subscribers: jroelofs, llvm-commits
Differential Revision: https://reviews.llvm.org/D41732
llvm-svn: 321877
2018-01-06 01:10:39 +08:00
|
|
|
|
|
|
|
RUN: not llvm-mt /oyt:%t 2>&1 | FileCheck %s -check-prefix=INVALID-BUT-CLOSE
|
2018-06-24 00:49:07 +08:00
|
|
|
INVALID-BUT-CLOSE: llvm-mt: error: invalid option '/oyt:{{.*}}help.test.tmp', did you mean '/out:{{.*}}help.test.tmp'?
|
2017-08-19 08:37:41 +08:00
|
|
|
|