[clang] [clang] Only build static analyzer sources if requested (PR #71653)

Chris B via cfe-commits cfe-commits at lists.llvm.org
Tue Nov 14 08:45:21 PST 2023


================
@@ -23,7 +23,9 @@ add_subdirectory(Tooling)
 add_subdirectory(DirectoryWatcher)
 add_subdirectory(Index)
 add_subdirectory(IndexSerialization)
-add_subdirectory(StaticAnalyzer)
+if(CLANG_ENABLE_STATIC_ANALYZER)
----------------
llvm-beanz wrote:

> Well yes, but I'm not introducing the option here, I'm just making it work.

My argument here would be that if the option doesn't work, maybe we shouldn't fix it. In particular I think having the static analyzer be conditional in the testing tools makes for a more complicated testing matrix. If you disable the static analyzer in the build you also need to disable it in the testing tools and the test cases.

This becomes a more complicated issue because changes in the AST library can impact correctness of the static analyzer, so should we really be supporting disabling the static analyzer from the testing?

It seems to me that we should maybe support `CLANG_ENABLE_STATIC_ANALYZER` as a way to remove the static analyzer from the clang built product, but not from the build, testing tools, or test cases.

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


More information about the cfe-commits mailing list