Skip to content

Commit

Permalink
[Driver] Test for correct '--version' suggestion
Browse files Browse the repository at this point in the history
Summary:
The `llvm::OptTable::findNearest` bug fixed in
https://reviews.llvm.org/D41873 manifested itself as the following
erroneous message when invoking Clang:

```
clang -version
clang-6.0: error: unknown argument '-version', did you mean 'version'?
```

Add a test to catch any future regressions to the now correct behavior,
which asks "did you mean '--version'?".

Test Plan: `check-clang`

Reviewers: v.g.vassilev, teemperor, ruiu, jroelofs, yamaguchi

Reviewed By: v.g.vassilev

Subscribers: cfe-commits

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

llvm-svn: 322220
  • Loading branch information
modocache committed Jan 10, 2018
1 parent 8d027d6 commit 5b60198
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion clang/test/Driver/unknown-arg.c
@@ -1,6 +1,6 @@
// RUN: not %clang %s -cake-is-lie -%0 -%d -HHHH -munknown-to-clang-option -print-stats -funknown-to-clang-option -### 2>&1 | \
// RUN: FileCheck %s
// RUN: not %clang %s -stdlibs=foo -hell -### 2>&1 | \
// RUN: not %clang %s -stdlibs=foo -hell -version -### 2>&1 | \
// RUN: FileCheck %s --check-prefix=DID-YOU-MEAN
// RUN: %clang_cl -cake-is-lie -%0 -%d -HHHH -munknown-to-clang-option -print-stats -funknown-to-clang-option -### -c -- %s 2>&1 | \
// RUN: FileCheck %s --check-prefix=CL
Expand All @@ -22,6 +22,7 @@
// CHECK: error: unknown argument: '-funknown-to-clang-option'
// DID-YOU-MEAN: error: unknown argument '-stdlibs=foo', did you mean '-stdlib=foo'?
// DID-YOU-MEAN: error: unknown argument '-hell', did you mean '-help'?
// DID-YOU-MEAN: error: unknown argument '-version', did you mean '--version'?
// CL: warning: unknown argument ignored in clang-cl: '-cake-is-lie'
// CL: warning: unknown argument ignored in clang-cl: '-%0'
// CL: warning: unknown argument ignored in clang-cl: '-%d'
Expand Down

0 comments on commit 5b60198

Please sign in to comment.