[clang-tools-extra] [clang-tidy] Fix loading clang-tidy as a Clang frontend plugin (PR #221961)

Zeyi Xu via cfe-commits cfe-commits at lists.llvm.org
Tue Sep 8 04:36:25 PDT 2026


================
@@ -8,10 +8,16 @@
 
 #include "../ClangTidy.h"
 #include "../ClangTidyDiagnosticConsumer.h"
+#include "../ClangTidyForceLinker.h" // IWYU pragma: keep
 #include "../ClangTidyModule.h"
 #include "clang/Frontend/CompilerInstance.h"
 #include "clang/Frontend/FrontendPluginRegistry.h"
 #include "clang/Frontend/MultiplexConsumer.h"
+#include "clang/StaticAnalyzer/Frontend/CheckerRegistry.h"
+
+// NOLINTNEXTLINE(readability-identifier-naming)
+extern "C" const char clang_analyzerAPIVersionString[] =
----------------
zeyi2 wrote:

This symbol follows the [analyzer plugin API documented in `CheckerRegistry.h`](https://github.com/llvm/llvm-project/blob/2449bae16b32b994282263be4cf1ece9441032f3/clang/include/clang/StaticAnalyzer/Frontend/CheckerRegistry.h#L26-L35). When analyzer checks are enabled, exporting it prevents an incompatible-plugin warning. Its name is fixed by the API, hence the naming-check suppression.

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


More information about the cfe-commits mailing list