[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:28:44 PDT 2025
https://github.com/NagyDonat updated https://github.com/llvm/llvm-project/pull/146042
>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 1/2] [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"
>From e4e8428a21e4a4fec426395a4856ff0621e88afe 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:28:31 +0200
Subject: [PATCH 2/2] Satisfy darker code formatting
---
clang/test/lit.cfg.py | 4 +---
1 file changed, 1 insertion(+), 3 deletions(-)
diff --git a/clang/test/lit.cfg.py b/clang/test/lit.cfg.py
index 3d79f44ff8967..1581ae4463a28 100644
--- a/clang/test/lit.cfg.py
+++ b/clang/test/lit.cfg.py
@@ -180,9 +180,7 @@ def have_host_clang_repl_cuda():
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)
- )
+ 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