diff --git a/clang/lib/Analysis/UnsafeBufferUsage.cpp b/clang/lib/Analysis/UnsafeBufferUsage.cpp --- a/clang/lib/Analysis/UnsafeBufferUsage.cpp +++ b/clang/lib/Analysis/UnsafeBufferUsage.cpp @@ -1017,8 +1017,6 @@ DeclUseTracker Tracker; { - // FIXME: We could skip even matching Fixables' matchers if EmitFixits == - // false. auto [FixableGadgets, WarningGadgets, TrackerRes] = findGadgets(D, Handler); UnsafeOps = groupWarningGadgetsByVar(std::move(WarningGadgets)); FixablesForUnsafeVars = groupFixablesByVar(std::move(FixableGadgets)); diff --git a/clang/lib/Sema/AnalysisBasedWarnings.cpp b/clang/lib/Sema/AnalysisBasedWarnings.cpp --- a/clang/lib/Sema/AnalysisBasedWarnings.cpp +++ b/clang/lib/Sema/AnalysisBasedWarnings.cpp @@ -2518,7 +2518,8 @@ UnsafeBufferUsageReporter R(S); checkUnsafeBufferUsage( D, R, - /*EmitFixits=*/S.getLangOpts().CPlusPlus20); + /*EmitFixits=*/S.getDiagnostics().getDiagnosticOptions().ShowFixits && + S.getLangOpts().CPlusPlus20); } // If none of the previous checks caused a CFG build, trigger one here