[llvm] b68692b - [lit][docs] Document %if conditional substitution in lit CommandGuide (#225683)

via llvm-commits llvm-commits at lists.llvm.org
Wed Sep 23 11:47:56 PDT 2026


Author: Ingo Müller
Date: 2026-09-23T20:47:45+02:00
New Revision: b68692b05a2e575b09a21f4310fc1a94241669ea

URL: https://github.com/llvm/llvm-project/commit/b68692b05a2e575b09a21f4310fc1a94241669ea
DIFF: https://github.com/llvm/llvm-project/commit/b68692b05a2e575b09a21f4310fc1a94241669ea.diff

LOG: [lit][docs] Document %if conditional substitution in lit CommandGuide (#225683)

`%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>

Added: 
    

Modified: 
    llvm/docs/CommandGuide/lit.md

Removed: 
    


################################################################################
diff  --git a/llvm/docs/CommandGuide/lit.md b/llvm/docs/CommandGuide/lit.md
index f652110bfc2cb..43d664942d532 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