Substitutions are already reported in the diagnostics appearing before
the input dump in the case of failed directives, and they're reported
in traces (produced by -vv -dump-input=never) in the case of
successful directives. However, those reports are not always
convenient to view while investigating the input dump, so this patch
adds the substitution report to the input dump too. For example:
$ cat check CHECK: hello [[WHAT:[a-z]+]] CHECK: [[VERB]] [[WHAT]] $ FileCheck -vv -DVERB=goodbye check < input |& tail -8 <<<<<< 1: hello world check:1 ^~~~~~~~~~~ 2: goodbye word check:2'0 X~~~~~~~~~~~ error: no match found check:2'1 with "VERB" equal to "goodbye" check:2'2 with "WHAT" equal to "world" >>>>>>
Without this patch, the location reported for a substitution for a
directive match is the directive's full match range. This location is
misleading as it implies the substitution itself matches that range.
This patch changes the reported location to just the match range start
to suggest the substitution is known at the start of the match. (As
in the above example, input dumps don't mark any range for
substitutions. The location info in that case simply identifies the
right line for the annotation.)
It should yes so you can rewrite the FIXME into something like "CHECK-NOT wrongly consider an undefined variable as a failure to match, fix first line input dump below once this is fixed".
IMHO, I think it should be fixed by making CheckNot handle UndefVarError errors and call a new printUndef and return true if any is found.