diff options
author | Justin Bogner <mail@justinbogner.com> | 2023-08-02 10:21:02 -0700 |
---|---|---|
committer | Justin Bogner <mail@justinbogner.com> | 2023-08-02 14:23:14 -0700 |
commit | 7ef1718c4d4ecd99f3ba48236f7fd4fd9ffb540c (patch) | |
tree | f94506852f4ff2a1c38c6ea3be35211d7632010d /clang/lib/Driver/Driver.cpp | |
parent | 61af957aeaa3ba69a64598966525af6a40280fa0 (diff) | |
download | llvm-7ef1718c4d4ecd99f3ba48236f7fd4fd9ffb540c.zip llvm-7ef1718c4d4ecd99f3ba48236f7fd4fd9ffb540c.tar.gz llvm-7ef1718c4d4ecd99f3ba48236f7fd4fd9ffb540c.tar.bz2 |
[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
Diffstat (limited to 'clang/lib/Driver/Driver.cpp')
-rw-r--r-- | clang/lib/Driver/Driver.cpp | 16 |
1 files changed, 3 insertions, 13 deletions
diff --git a/clang/lib/Driver/Driver.cpp b/clang/lib/Driver/Driver.cpp index a43d3f0..b340030 100644 --- a/clang/lib/Driver/Driver.cpp +++ b/clang/lib/Driver/Driver.cpp @@ -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; } |