[clang] [Clang] Don't build static analyzer if disabled (PR #212024)

Alexis Engelke via cfe-commits cfe-commits at lists.llvm.org
Sat Jul 25 06:58:44 PDT 2026


https://github.com/aengelke created https://github.com/llvm/llvm-project/pull/212024

Even if the static analyzer is disabled, it still gets built into the
dylib. Unit tests and tools already get disables, so also stop building
the library. This reduces the time needed to build a dylib clang by
8-9%.


>From 73f6b3aae57d9d82c84980198ea41fc417f23480 Mon Sep 17 00:00:00 2001
From: Alexis Engelke <engelke at in.tum.de>
Date: Sat, 25 Jul 2026 13:58:03 +0000
Subject: [PATCH] [spr] initial version

Created using spr 1.3.8-wip
---
 clang/lib/CMakeLists.txt | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/clang/lib/CMakeLists.txt b/clang/lib/CMakeLists.txt
index dee31cb3f166e..49e2c4c77a870 100644
--- a/clang/lib/CMakeLists.txt
+++ b/clang/lib/CMakeLists.txt
@@ -24,7 +24,9 @@ add_subdirectory(Index)
 add_subdirectory(IndexSerialization)
 add_subdirectory(InstallAPI)
 add_subdirectory(ScalableStaticAnalysis)
-add_subdirectory(StaticAnalyzer)
+if(CLANG_ENABLE_STATIC_ANALYZER)
+  add_subdirectory(StaticAnalyzer)
+endif()
 add_subdirectory(Format)
 if(CLANG_INCLUDE_TESTS)
   add_subdirectory(Testing)



More information about the cfe-commits mailing list