[Driver] Suggest correctly spelled driver options
Summary:
Depends on https://reviews.llvm.org/D41732.
Utilities such as `opt`, when invoked with arguments that are very
nearly spelled correctly, suggest the correctly spelled options:
```
bin/opt -hel
opt: Unknown command line argument '-hel'. Try: 'bin/opt -help'
opt: Did you mean '-help'?
```
Clang, on the other hand, prior to this commit, does not:
```
bin/clang -hel
clang-6.0: error: unknown argument: '-hel'
```
This commit makes use of the new libLLVMOption API from
https://reviews.llvm.org/D41732 in order to provide correct suggestions:
```
bin/clang -hel
clang-6.0: error: unknown argument: '-hel', did you mean '-help'?
```
Test Plan: `check-clang`
Reviewers: yamaguchi, v.g.vassilev, teemperor, ruiu, bruno
Reviewed By: bruno
Subscribers: bruno, jroelofs, cfe-commits
Differential Revision: https://reviews.llvm.org/D41733
llvm-svn: 321917
2018-01-06 08:25:40 +08:00
|
|
|
// RUN: not %clang %s --hedonism -### 2>&1 | \
|
|
|
|
// RUN: FileCheck %s
|
|
|
|
// RUN: not %clang %s --hell -### 2>&1 | \
|
|
|
|
// RUN: FileCheck %s --check-prefix=DID-YOU-MEAN
|
|
|
|
|
|
|
|
// CHECK: error: unsupported option '--hedonism'
|
2019-05-24 01:58:33 +08:00
|
|
|
// DID-YOU-MEAN: error: unsupported option '--hell'; did you mean '--help'?
|