[libcxx-commits] [libcxx] a861703 - [libc++][utils] Fix LIT `%if` substitution support (#209358)
via libcxx-commits
libcxx-commits at lists.llvm.org
Mon Jul 20 06:36:48 PDT 2026
Author: Hubert Tong
Date: 2026-07-20T09:36:43-04:00
New Revision: a8617034c4a7cc733676a31b736d3118fec34259
URL: https://github.com/llvm/llvm-project/commit/a8617034c4a7cc733676a31b736d3118fec34259
DIFF: https://github.com/llvm/llvm-project/commit/a8617034c4a7cc733676a31b736d3118fec34259.diff
LOG: [libc++][utils] Fix LIT `%if` substitution support (#209358)
Update the applySubstitutions call in `libcxx/utils/libcxx/test/format.py` to match the
change to `llvm/utils/lit/lit/TestRunner.py` done in 1041a9642ba0.
Added:
libcxx/test/selftest/if-else.sh.cpp
Modified:
libcxx/utils/libcxx/test/format.py
Removed:
################################################################################
diff --git a/libcxx/test/selftest/if-else.sh.cpp b/libcxx/test/selftest/if-else.sh.cpp
new file mode 100644
index 0000000000000..06b09ac9067a5
--- /dev/null
+++ b/libcxx/test/selftest/if-else.sh.cpp
@@ -0,0 +1,11 @@
+//===----------------------------------------------------------------------===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+// Make sure that LIT `%if` substitutions are aware of the available features.
+
+// RUN: not %if target={{.+}} %{ not %} echo "hello world"
diff --git a/libcxx/utils/libcxx/test/format.py b/libcxx/utils/libcxx/test/format.py
index 49cbe8a8db618..e3e81fd1cf36f 100644
--- a/libcxx/utils/libcxx/test/format.py
+++ b/libcxx/utils/libcxx/test/format.py
@@ -205,8 +205,12 @@ def parseScript(test, preamble):
)
# Perform substitutions in the script itself.
+ conditions = {feature: True for feature in test.config.available_features}
script = lit.TestRunner.applySubstitutions(
- script, substitutions, recursion_limit=test.config.recursiveExpansionLimit
+ script,
+ substitutions,
+ conditions,
+ recursion_limit=test.config.recursiveExpansionLimit,
)
return script
More information about the libcxx-commits
mailing list