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

Timm Baeder via cfe-commits cfe-commits at lists.llvm.org
Wed Nov 8 02:46:04 PST 2023


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

There used to be a patch similar to this on Phabricator. I asked a long time ago if I can pick it up but the author told me they will work on it, which never happened.

IIRC there also was a problem with this simple patch since some other component depends on the static analyzer being built. Let's see what CI says.

>From aec458976c007f2666c2a1939bf8e48b1840a3fd Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Timm=20B=C3=A4der?= <tbaeder at redhat.com>
Date: Wed, 8 Nov 2023 11:43:22 +0100
Subject: [PATCH] [clang] Only build static analyzer sources if requested

---
 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 1526d65795f8adf..e897fbb16c60d78 100644
--- a/clang/lib/CMakeLists.txt
+++ b/clang/lib/CMakeLists.txt
@@ -23,7 +23,9 @@ add_subdirectory(Tooling)
 add_subdirectory(DirectoryWatcher)
 add_subdirectory(Index)
 add_subdirectory(IndexSerialization)
-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