[clang-tools-extra] [clangd] Make it possible to enable misc-const-correctness clang-tidy check (PR #94920)

via cfe-commits cfe-commits at lists.llvm.org
Sun Jun 9 15:03:14 PDT 2024


https://github.com/geza-herman created https://github.com/llvm/llvm-project/pull/94920

Before this PR, it wasn't possible to enable misc-const-correctness: disableUnusableChecks() forcefully disabled it because the check is slow.  It was implemented this way before clangd got the FastCheckFilter feature.  As the default setting of FastCheckFilter also disables misc-const-correctness, it makes sense to remove misc-const-correctness from disableUnusableChecks()'s list, to make it possible to enable misc-const-correctness by setting FastCheckFilter to None.  Fixes https://github.com/llvm/llvm-project/issues/89758.

>From 6c251aa7d749581964f279255ff03fa8b765dcbb Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?G=C3=A9za=20Herman?= <geza.herman at gmail.com>
Date: Sun, 9 Jun 2024 23:38:42 +0200
Subject: [PATCH] [clangd] Make it possible to enable misc-const-correctness
 clang-tidy check

Before this commit, it wasn't possible to enable misc-const-correctness:
disableUnusableChecks() forcefully disabled it because the check is slow.  It
was implemented this way before clangd got the FastCheckFilter feature.  As the
default setting of FastCheckFilter also disables misc-const-correctness, it
makes sense to remove misc-const-correctness from disableUnusableChecks()'s
list, to make it possible to enable misc-const-correctness by setting
FastCheckFilter to None.  Fixes #89758.
---
 clang-tools-extra/clangd/TidyProvider.cpp | 8 +-------
 1 file changed, 1 insertion(+), 7 deletions(-)

diff --git a/clang-tools-extra/clangd/TidyProvider.cpp b/clang-tools-extra/clangd/TidyProvider.cpp
index b658a80559937..a4121df30d3df 100644
--- a/clang-tools-extra/clangd/TidyProvider.cpp
+++ b/clang-tools-extra/clangd/TidyProvider.cpp
@@ -221,13 +221,7 @@ TidyProvider disableUnusableChecks(llvm::ArrayRef<std::string> ExtraBadChecks) {
       "-hicpp-invalid-access-moved",
       // Check uses dataflow analysis, which might hang/crash unexpectedly on
       // incomplete code.
-      "-bugprone-unchecked-optional-access",
-
-      // ----- Performance problems -----
-
-      // This check runs expensive analysis for each variable.
-      // It has been observed to increase reparse time by 10x.
-      "-misc-const-correctness");
+      "-bugprone-unchecked-optional-access");
 
   size_t Size = BadChecks.size();
   for (const std::string &Str : ExtraBadChecks) {



More information about the cfe-commits mailing list