[llvm] [lit][docs] Document %if conditional substitution in lit CommandGuide (PR #225683)
Ingo Müller via llvm-commits
llvm-commits at lists.llvm.org
Wed Sep 23 04:03:10 PDT 2026
https://github.com/ingomueller-net updated https://github.com/llvm/llvm-project/pull/225683
>From 85986f64eb467901eaedced6589f0f24e96d0df3 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Ingo=20M=C3=BCller?= <ingomueller at google.com>
Date: Wed, 23 Sep 2026 13:02:41 +0200
Subject: [PATCH] [lit][docs] Document %if conditional substitution in lit
CommandGuide.
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
`%if ... %else` conditional substitutions (implemented in `TestRunner.py`
and mentioned in `TestingGuide.md`) were missing from the `SUBSTITUTIONS`
table and `available_features` description in `llvm/docs/CommandGuide/lit.md`.
Add `%if` to the base substitutions table and note that `available_features`
can be used in `%if` conditions.
Signed-off-by: Ingo Müller <ingomueller at google.com>
---
llvm/docs/CommandGuide/lit.md | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/llvm/docs/CommandGuide/lit.md b/llvm/docs/CommandGuide/lit.md
index f652110bfc2cbb..43d664942d532b 100644
--- a/llvm/docs/CommandGuide/lit.md
+++ b/llvm/docs/CommandGuide/lit.md
@@ -606,7 +606,7 @@ executed, two important global variables are predefined:
**available_features**
: A set of features that can be used in `XFAIL`, `REQUIRES`, and `UNSUPPORTED`
- directives.
+ directives and `%if` substitutions.
### TEST DISCOVERY
@@ -679,6 +679,7 @@ TestRunner.py:
| %:p | On Windows, %/p but a `:` is removed if its the second character. Otherwise, %p but with a single leading `/` removed. |
| %:t | On Windows, %/t but a `:` is removed if its the second character. Otherwise, %t but with a single leading `/` removed. |
| %{readfile:\<filename>} | Reads the file specified. |
+| %if \<cond> %{...%} | Conditional substitution (`%if <cond> %{<if-branch>%} [%else %{<else-branch>%}]`); `<cond>` uses `available_features`. |
Other substitutions are provided that are variations on this base set and
further substitution patterns can be defined by each test module. See the
More information about the llvm-commits
mailing list