[PATCH] D156925: [Driver] Don't try to spell check unsupported options
Justin Bogner via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Wed Aug 2 14:36:23 PDT 2023
This revision was landed with ongoing or failed builds.
This revision was automatically updated to reflect the committed changes.
Closed by commit rG7ef1718c4d4e: [Driver] Don't try to spell check unsupported options (authored by bogner).
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D156925/new/
https://reviews.llvm.org/D156925
Files:
clang/include/clang/Driver/Options.td
clang/lib/Driver/Driver.cpp
clang/test/Driver/unsupported-option.c
flang/test/Driver/driver-version.f90
Index: flang/test/Driver/driver-version.f90
===================================================================
--- flang/test/Driver/driver-version.f90
+++ flang/test/Driver/driver-version.f90
@@ -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
Index: clang/test/Driver/unsupported-option.c
===================================================================
--- clang/test/Driver/unsupported-option.c
+++ clang/test/Driver/unsupported-option.c
@@ -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
Index: clang/lib/Driver/Driver.cpp
===================================================================
--- clang/lib/Driver/Driver.cpp
+++ clang/lib/Driver/Driver.cpp
@@ -286,19 +286,9 @@
// 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;
}
Index: clang/include/clang/Driver/Options.td
===================================================================
--- clang/include/clang/Driver/Options.td
+++ clang/include/clang/Driver/Options.td
@@ -4773,7 +4773,6 @@
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 {
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D156925.546615.patch
Type: text/x-patch
Size: 2956 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20230802/8273af58/attachment.bin>
More information about the cfe-commits
mailing list