[Driver] Don't try to spell check unsupported options
We currently spell check options that are listed as unsupported, but this doesn't make much sense. If an option is explicitly unsupported why would one that's spelled similarly be useful? It looks like the reason this was added was that we explicitly mark all `--something` flags as Unsupported rather than just leaving them undefined and treating them as unknown. Drop that handling so that we don't regress on things like misspelling `--help`. Differential Revision: https://reviews.llvm.org/D156925
This commit is contained in:
parent
61af957aea
commit
7ef1718c4d
4 changed files with 6 additions and 17 deletions
|
|
@ -4773,7 +4773,6 @@ def _warn__EQ : Joined<["--"], "warn-=">, Alias<W_Joined>;
|
|||
def _warn_ : Joined<["--"], "warn-">, Alias<W_Joined>;
|
||||
def _write_dependencies : Flag<["--"], "write-dependencies">, Alias<MD>;
|
||||
def _write_user_dependencies : Flag<["--"], "write-user-dependencies">, Alias<MMD>;
|
||||
def _ : Joined<["--"], "">, Flags<[Unsupported]>;
|
||||
|
||||
// Hexagon feature flags.
|
||||
let Flags = [TargetSpecific] in {
|
||||
|
|
|
|||
|
|
@ -286,19 +286,9 @@ InputArgList Driver::ParseArgStrings(ArrayRef<const char *> ArgStrings,
|
|||
// Check for unsupported options.
|
||||
for (const Arg *A : Args) {
|
||||
if (A->getOption().hasFlag(options::Unsupported)) {
|
||||
unsigned DiagID;
|
||||
auto ArgString = A->getAsString(Args);
|
||||
std::string Nearest;
|
||||
if (getOpts().findNearest(
|
||||
ArgString, Nearest, IncludedFlagsBitmask,
|
||||
ExcludedFlagsBitmask | options::Unsupported) > 1) {
|
||||
DiagID = diag::err_drv_unsupported_opt;
|
||||
Diag(DiagID) << ArgString;
|
||||
} else {
|
||||
DiagID = diag::err_drv_unsupported_opt_with_suggestion;
|
||||
Diag(DiagID) << ArgString << Nearest;
|
||||
}
|
||||
ContainsError |= Diags.getDiagnosticLevel(DiagID, SourceLocation()) >
|
||||
Diag(diag::err_drv_unsupported_opt) << A->getAsString(Args);
|
||||
ContainsError |= Diags.getDiagnosticLevel(diag::err_drv_unsupported_opt,
|
||||
SourceLocation()) >
|
||||
DiagnosticsEngine::Warning;
|
||||
continue;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,10 +1,10 @@
|
|||
// RUN: not %clang %s --hedonism -### 2>&1 | \
|
||||
// RUN: FileCheck %s
|
||||
// CHECK: error: unsupported option '--hedonism'
|
||||
// CHECK: error: unknown argument: '--hedonism'
|
||||
|
||||
// RUN: not %clang %s --hell -### 2>&1 | \
|
||||
// RUN: FileCheck %s --check-prefix=DID-YOU-MEAN
|
||||
// DID-YOU-MEAN: error: unsupported option '--hell'; did you mean '--help'?
|
||||
// DID-YOU-MEAN: error: unknown argument '--hell'; did you mean '--help'?
|
||||
|
||||
// RUN: not %clang --target=powerpc-ibm-aix %s -mlong-double-128 2>&1 | \
|
||||
// RUN: FileCheck %s --check-prefix=AIX-LONGDOUBLE128-ERR
|
||||
|
|
|
|||
|
|
@ -9,7 +9,7 @@
|
|||
! VERSION-NEXT: Thread model:
|
||||
! VERSION-NEXT: InstalledDir:
|
||||
|
||||
! ERROR: flang-new: error: unsupported option '--versions'; did you mean '--version'?
|
||||
! ERROR: flang-new: error: unknown argument '--versions'; did you mean '--version'?
|
||||
|
||||
! VERSION-FC1: LLVM version
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue