These directives define per-test lit substitutions. The concept was
discussed at
https://discourse.llvm.org/t/iterating-lit-run-lines/62596/10.
For example, the following directives can be inserted into a test file
to define %{cflags} and %{fcflags} substitutions with empty
initial values, which serve as the parameters of another newly defined
%{check} substitution:
// DEFINE: %{cflags} = // DEFINE: %{fcflags} = // DEFINE: %{check} = %clang_cc1 %{cflags} -emit-llvm -o - %s | \ // DEFINE: FileCheck %{fcflags} %s
The following directives then redefine the parameters before each use
of %{check}:
// REDEFINE: %{cflags} = -foo // REDEFINE: %{fcflags} = -check-prefix=FOO // RUN: %{check} // REDEFINE: %{cflags} = -bar // REDEFINE: %{fcflags} = -check-prefix=BAR // RUN: %{check}
Of course, %{check} would typically be more elaborate, increasing
the benefit of the reuse.
One issue is that the strings DEFINE: and REDEFINE: already appear
in 5 tests. This patch adjusts those tests not to use those strings.
Our prediction is that, in the vast majority of cases, if a test
author mistakenly uses one of those strings for another purpose, the
text appearing after the string will not happen to have the syntax
required for these directives. Thus, the test author will discover
the mistake immediately when lit reports the syntax error.
This patch also expands the documentation on existing lit substitution
behavior.
Why delete "This can be used in tests with multiple RUN lines, which reference test file's line numbers"?