[PATCH] D53897: [FileCheck] Annotate input dump (5/7)
Joel E. Denny via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Tue Oct 30 14:17:09 PDT 2018
jdenny created this revision.
Herald added subscribers: kristina, hiraditya.
This patch implements input annotations for diagnostics enabled by -v,
which report good matches for directives. These annotations mark
match ranges using `^~~`.
For example:
$ FileCheck -v -dump-input=always check3 < input3 |& sed -n '/^Format for/,$p'
Format for input dump annotations:
- L:S labels line number L of the input file, where S is a single space
- T:L labels the only match result for a pattern of type T from line L of
the check file
- T:L'N labels the Nth match result for a pattern of type T from line L of
the check file
- ^~~ marks good match (requires -v)
- !~~ marks bad match
- X~~ marks search range when no match is found
- ? marks fuzzy match when no match is found
Detailed description of currently enabled markers:
- ^~~ marks the final match for an expected pattern (e.g., CHECK)
- !~~ marks either:
- the final match for an excluded pattern (e.g., CHECK-NOT)
- the final but illegal match for an expected pattern (e.g., CHECK-NEXT)
- X~~ marks the search range for an unmatched expected pattern (e.g., CHECK)
- ? marks a fuzzy match start for an otherwise unmatched pattern
Input file: <stdin>
Check file: check3
Full input was:
<<<<<<
1: abc foobar def
check:1 ^~~
not:2 !~~~~~
check:3 ^~~
>>>>>>
$ cat check3
CHECK: abc
CHECK-NOT: foobar
CHECK: def
$ cat input3
abc foobar def
-vv enables these annotations for FileCheck's implicit EOF patterns as
well. For an example where EOF patterns become relevant, see patch 7
in this series.
If colors are enabled, `^~~` is green to suggest success.
-v plus color enables highlighting of input text that has no final
match for any expected pattern. The highlight uses a cyan background
to suggest a cold section. This highlighting can make it easier to
spot text that was intended to be matched but that failed to be
matched in a long series of good matches.
Repository:
rL LLVM
https://reviews.llvm.org/D53897
Files:
llvm/include/llvm/Support/FileCheck.h
llvm/lib/Support/FileCheck.cpp
llvm/test/FileCheck/dump-input-annotations.txt
llvm/test/FileCheck/dump-input-enable.txt
llvm/utils/FileCheck/FileCheck.cpp
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D53897.171796.patch
Type: text/x-patch
Size: 18638 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20181030/92463673/attachment.bin>
More information about the llvm-commits
mailing list