[llvm] [clang-tidy] Fix bazel build after #131804 (lazy style). (PR #159289)

Ingo Müller via llvm-commits llvm-commits at lists.llvm.org
Wed Sep 17 01:59:20 PDT 2025


https://github.com/ingomueller-net created https://github.com/llvm/llvm-project/pull/159289

This PR provides a quick fix for the bazel builds that got broken by #131804. That PR introduced a new CMake option that enables custom clang-tidy checks that are provided by cmake-query. This PR disables those checks, which is the minimal fix. A more proper fix would introduce a new `custom` check that is added to the tool if a particular flag value is set; however, the library depends on clang-query, which isn't part of the bazel build, yet, and I don't want to spend the time now to make all of that work as well. The discussion in the PR provides my current state in case somebody wants to pick up that work.

>From 0e6d11c931ab950cf2db02da1e33853770d252fb Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Ingo=20M=C3=BCller?= <ingomueller at google.com>
Date: Wed, 17 Sep 2025 08:55:23 +0000
Subject: [PATCH] [clang-tidy] Fix bazel build after #131804 (lazy style).
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

This PR provides a quick fix for the bazel builds that got broken by
 #131804. That PR introduced a new CMake option that enables custom
clang-tidy checks that are provided by cmake-query. This PR disables
those checks, which is the minimal fix. A more proper fix would
introduce a new `custom` check that is added to the tool if a particular
flag value is set; however, the library depends on clang-query, which
isn't part of the bazel build, yet, and I don't want to spend the time
now to make all of that work as well. The discussion in the PR provides
my current state in case somebody wants to pick up that work.

Signed-off-by: Ingo Müller <ingomueller at google.com>
---
 .../clang-tools-extra/clang-tidy/BUILD.bazel  | 19 +++++++++++--------
 1 file changed, 11 insertions(+), 8 deletions(-)

diff --git a/utils/bazel/llvm-project-overlay/clang-tools-extra/clang-tidy/BUILD.bazel b/utils/bazel/llvm-project-overlay/clang-tools-extra/clang-tidy/BUILD.bazel
index f779be14ee468..6a8e8b4485313 100644
--- a/utils/bazel/llvm-project-overlay/clang-tools-extra/clang-tidy/BUILD.bazel
+++ b/utils/bazel/llvm-project-overlay/clang-tools-extra/clang-tidy/BUILD.bazel
@@ -33,14 +33,17 @@ config_setting(
 expand_template(
     name = "config",
     out = "clang-tidy-config.h",
-    substitutions = select({
-        ":static_analyzer_enabled": {
-            "#cmakedefine01 CLANG_TIDY_ENABLE_STATIC_ANALYZER": "#define CLANG_TIDY_ENABLE_STATIC_ANALYZER 1",
-        },
-        "//conditions:default": {
-            "#cmakedefine01 CLANG_TIDY_ENABLE_STATIC_ANALYZER": "#define CLANG_TIDY_ENABLE_STATIC_ANALYZER 0",
-        },
-    }),
+    substitutions =
+        {
+            "#cmakedefine01 CLANG_TIDY_ENABLE_QUERY_BASED_CUSTOM_CHECKS": "#define CLANG_TIDY_ENABLE_QUERY_BASED_CUSTOM_CHECKS 0",
+        } | select({
+            ":static_analyzer_enabled": {
+                "#cmakedefine01 CLANG_TIDY_ENABLE_STATIC_ANALYZER": "#define CLANG_TIDY_ENABLE_STATIC_ANALYZER 1",
+            },
+            "//conditions:default": {
+                "#cmakedefine01 CLANG_TIDY_ENABLE_STATIC_ANALYZER": "#define CLANG_TIDY_ENABLE_STATIC_ANALYZER 0",
+            },
+        }),
     template = "clang-tidy-config.h.cmake",
     visibility = ["//visibility:private"],
 )



More information about the llvm-commits mailing list