[clang] [analyzer] Fix tests broken by empty %z3_include_dir (PR #146042)
DonĂ¡t Nagy via cfe-commits
cfe-commits at lists.llvm.org
Fri Jun 27 02:24:20 PDT 2025
https://github.com/NagyDonat created https://github.com/llvm/llvm-project/pull/146042
This commit should fix the build failure caused by my recent commit 40cc4379cda6e0d6efe72c55d1968f9cf427a16a
>From b7bfc546397c42b1e26cfd0d10bdf583d0091ff4 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Don=C3=A1t=20Nagy?= <donat.nagy at ericsson.com>
Date: Fri, 27 Jun 2025 11:22:29 +0200
Subject: [PATCH] [analyzer] Fix tests broken by empty %z3_include_dir
---
clang/test/Analysis/z3-crosscheck-max-attempts.cpp | 2 +-
clang/test/Analysis/z3/D83660.c | 2 +-
clang/test/lit.cfg.py | 9 ++++++---
3 files changed, 8 insertions(+), 5 deletions(-)
diff --git a/clang/test/Analysis/z3-crosscheck-max-attempts.cpp b/clang/test/Analysis/z3-crosscheck-max-attempts.cpp
index 572e452fdcac2..1c93f32fc21f5 100644
--- a/clang/test/Analysis/z3-crosscheck-max-attempts.cpp
+++ b/clang/test/Analysis/z3-crosscheck-max-attempts.cpp
@@ -4,7 +4,7 @@
// CHECK: crosscheck-with-z3-max-attempts-per-query = 3
// RUN: rm -rf %t && mkdir %t
-// RUN: %host_cxx -shared -fPIC -I %z3_include_dir \
+// RUN: %host_cxx -shared -fPIC %I_z3_include_dir \
// RUN: %S/z3/Inputs/MockZ3_solver_check.cpp \
// RUN: -o %t/MockZ3_solver_check.so
diff --git a/clang/test/Analysis/z3/D83660.c b/clang/test/Analysis/z3/D83660.c
index 0a7c8bab8e345..a24566adbc7d1 100644
--- a/clang/test/Analysis/z3/D83660.c
+++ b/clang/test/Analysis/z3/D83660.c
@@ -1,5 +1,5 @@
// RUN: rm -rf %t && mkdir %t
-// RUN: %host_cxx -shared -fPIC -I %z3_include_dir \
+// RUN: %host_cxx -shared -fPIC %I_z3_include_dir \
// RUN: %S/Inputs/MockZ3_solver_check.cpp \
// RUN: -o %t/MockZ3_solver_check.so
//
diff --git a/clang/test/lit.cfg.py b/clang/test/lit.cfg.py
index 24bcdb5b668fc..3d79f44ff8967 100644
--- a/clang/test/lit.cfg.py
+++ b/clang/test/lit.cfg.py
@@ -173,13 +173,16 @@ def have_host_clang_repl_cuda():
config.available_features.add("staticanalyzer")
tools.append("clang-check")
+ I_z3_include_dir = ""
if config.clang_staticanalyzer_z3:
config.available_features.add("z3")
- config.substitutions.append(
- ("%z3_include_dir", config.clang_staticanalyzer_z3_include_dir)
- )
+ if config.clang_staticanalyzer_z3_include_dir:
+ I_z3_include_dir = '-I "%s"' % config.clang_staticanalyzer_z3_include_dir
else:
config.available_features.add("no-z3")
+ config.substitutions.append(
+ ("%I_z3_include_dir", I_z3_include_dir)
+ )
check_analyzer_fixit_path = os.path.join(
config.test_source_root, "Analysis", "check-analyzer-fixit.py"
More information about the cfe-commits
mailing list