[clang-tools-extra] [clangd] Add code action to suppress clang-tidy diagnostics (PR #188796)

Adrian Vogelsgesang via cfe-commits cfe-commits at lists.llvm.org
Thu Mar 26 20:22:49 PDT 2026


================
@@ -605,6 +671,10 @@ std::vector<Diag> StoreDiags::take(const clang::tidy::ClangTidyContext *Tidy) {
       if (!TidyDiag.empty()) {
         Diag.Name = std::move(TidyDiag);
         Diag.Source = Diag::ClangTidy;
+        if (auto NolintFix = makeNolintFix(Code, Diag))
+          Diag.Fixes.push_back(std::move(*NolintFix));
+        if (auto NolintNextLineFix = makeNolintNextLineFix(Code, Diag))
+          Diag.Fixes.push_back(std::move(*NolintNextLineFix));
----------------
vogelsgesang wrote:

In one of the code bases I am contributing to, we only use `NOLINTNEXTLINE` and never use `NOLINT`. 
Would be great to have a setting in the `.clangd` config controlling which suppression style gets suggested (possible values `same-line`, `previous-line`, `off` or `both`)

https://github.com/llvm/llvm-project/pull/188796


More information about the cfe-commits mailing list