Skip to content

Commit 82f3c5d

Browse files
committed
[lit] Document the undocumented pre-defined substitutions
1 parent a44ef02 commit 82f3c5d

File tree

1 file changed

+32
-11
lines changed

1 file changed

+32
-11
lines changed

llvm/docs/CommandGuide/lit.rst

Lines changed: 32 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -406,17 +406,38 @@ PRE-DEFINED SUBSTITUTIONS
406406
:program:`lit` provides various patterns that can be used with the RUN command.
407407
These are defined in TestRunner.py. The base set of substitutions are:
408408

409-
========== ==============
410-
Macro Substitution
411-
========== ==============
412-
%s source path (path to the file currently being run)
413-
%S source dir (directory of the file currently being run)
414-
%p same as %S
415-
%{pathsep} path separator
416-
%t temporary file name unique to the test
417-
%T parent directory of %t (not unique, deprecated, do not use)
418-
%% %
419-
========== ==============
409+
======================= ==============
410+
Macro Substitution
411+
======================= ==============
412+
%s source path (path to the file currently being run)
413+
%S source dir (directory of the file currently being run)
414+
%p same as %S
415+
%{pathsep} path separator
416+
%t temporary file name unique to the test
417+
%basename_t The last path component of %t but without the ``.tmp`` extension
418+
%T parent directory of %t (not unique, deprecated, do not use)
419+
%% %
420+
%/s %s but ``\`` is replaced by ``/``
421+
%/S %S but ``\`` is replaced by ``/``
422+
%/p %p but ``\`` is replaced by ``/``
423+
%/t %t but ``\`` is replaced by ``/``
424+
%/T %T but ``\`` is replaced by ``/``
425+
%{/s:regex_replacement} %/s but escaped for use in the replacement of a ``s@@@`` command in sed
426+
%{/S:regex_replacement} %/S but escaped for use in the replacement of a ``s@@@`` command in sed
427+
%{/p:regex_replacement} %/p but escaped for use in the replacement of a ``s@@@`` command in sed
428+
%{/t:regex_replacement} %/t but escaped for use in the replacement of a ``s@@@`` command in sed
429+
%{/T:regex_replacement} %/T but escaped for use in the replacement of a ``s@@@`` command in sed
430+
%:s On Windows, %/s but a ``:`` is removed if its the second character.
431+
Otherwise, %s but with a single leading ``/`` removed.
432+
%:S On Windows, %/S but a ``:`` is removed if its the second character.
433+
Otherwise, %S but with a single leading ``/`` removed.
434+
%:p On Windows, %/p but a ``:`` is removed if its the second character.
435+
Otherwise, %p but with a single leading ``/`` removed.
436+
%:t On Windows, %/t but a ``:`` is removed if its the second character.
437+
Otherwise, %t but with a single leading ``/`` removed.
438+
%:T On Windows, %/T but a ``:`` is removed if its the second character.
439+
Otherwise, %T but with a single leading ``/`` removed.
440+
======================= ==============
420441

421442
Other substitutions are provided that are variations on this base set and
422443
further substitution patterns can be defined by each test module. See the

0 commit comments

Comments
 (0)