HomePhabricator

[FileCheck] Annotate input dump (4/7)

Description

[FileCheck] Annotate input dump (4/7)

This patch implements input annotations for diagnostics that report
unexpected matches for CHECK-NOT. Like wrong-line matches for
CHECK-NEXT, CHECK-SAME, and CHECK-EMPTY, these annotations mark match
ranges using red !~~ to indicate bad matches that are errors.

For example:

$ FileCheck -dump-input=help
The following description was requested by -dump-input=help to
explain the input annotations printed by -dump-input=always and
-dump-input=fail:

  - L:     labels line number L of the input file
  - 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 bad match, such as:
           - CHECK-NEXT on same line as previous match (error)
           - CHECK-NOT found (error)
  - X~~    marks search range when no match is found, such as:
           - CHECK-NEXT not found (error)
  - ?      marks fuzzy match when no match is found
  - colors error, fuzzy match

If you are not seeing color above or in input dumps, try: -color

$ FileCheck -v -dump-input=always check3 < input3 |& sed -n '/^<<<</,$p'
<<<<<<
       1: abc foobar def
not:2         !~~~~~     error: no match expected
>>>>>>

$ cat check3
CHECK:     abc
CHECK-NOT: foobar
CHECK:     def

$ cat input3
abc foobar def

Reviewed By: george.karpenkov, probinson

Differential Revision: https://reviews.llvm.org/D53896

Details

Committed
jdennyDec 17 2018, 4:02 PM
Reviewer
george.karpenkov
Differential Revision
D53896: [FileCheck] Annotate input dump (4/7)
Parents
rL349420: [FileCheck] Annotate input dump (3/7)
Branches
Unknown
Tags
Unknown