[clang-tools-extra] Revert "[clang-tidy] support query based custom check" (PR #159380)

Ingo Müller via cfe-commits cfe-commits at lists.llvm.org
Wed Sep 17 08:17:17 PDT 2025


ingomueller-net wrote:

I have tried to add the missing dependency as follows:

```patch
diff --git a/clang-tools-extra/clang-tidy/CMakeLists.txt b/clang-tools-extra/clang-tidy/CMakeLists.txt
index 153356245cfd..d3bbe0176688 100644
--- a/clang-tools-extra/clang-tidy/CMakeLists.txt
+++ b/clang-tools-extra/clang-tidy/CMakeLists.txt
@@ -48,6 +48,13 @@ if(CLANG_TIDY_ENABLE_STATIC_ANALYZER)
   )
 endif()
 
+if(CLANG_TIDY_ENABLE_QUERY_BASED_CUSTOM_CHECKS)
+  clang_target_link_libraries(clangTidy
+    PRIVATE
+    clangTidyCustomModule
+  )
+endif()
+
 # Checks.
 # If you add a check, also add it to ClangTidyForceLinker.h in this directory.
 add_subdirectory(android)
```

This, however, makes the dependency graph cyclic. I get the following error message when running CMake:

```
CMake Error: The inter-target dependency graph contains the following strongly connected component (cycle):
  "obj.clangTidy" of type OBJECT_LIBRARY
    depends on "clangTidyCustomModule" (weak)
  "clangTidy" of type SHARED_LIBRARY
    depends on "clangTidyCustomModule" (weak)
    depends on "obj.clangTidy" (strong)
  "clangTidyCustomModule" of type SHARED_LIBRARY
    depends on "clangTidy" (weak)
    depends on "clangTidyUtils" (weak)
  "clangTidyUtils" of type SHARED_LIBRARY
    depends on "clangTidy" (weak)
At least one of these targets is not a STATIC_LIBRARY.  Cyclic dependencies are allowed only among static libraries.
```

I assume that the original author has only built their code using static libraries but the broken build bot and I use dynamic libraries.

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


More information about the cfe-commits mailing list