[PATCH] D53899: [FileCheck] Annotate input dump (7/7)

Joel E. Denny via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Oct 30 14:22:27 PDT 2018


jdenny created this revision.
Herald added subscribers: kristina, hiraditya.
jdenny added a dependency: D53898: [FileCheck] Annotate input dump (6/7).

This patch implements annotations for diagnostics reporting CHECK-NOT
failed matches.  These diagnostics are enabled by -vv.  As for
diagnostics reporting failed matches for other directives, these
annotations mark the search ranges using `X~~`.  The difference here
is that failed matches for CHECK-NOT are successes not errors, so they
are green not red when colors are enabled.

For example:

  $ FileCheck -vv -dump-input=always check5 < input5 |& 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)
             - a discarded match for an expected pattern (e.g., CHECK-DAG)
    - X~~    marks either:
             - the search range for an unmatched excluded pattern (e.g., CHECK-NOT)
             - 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: check5
  
  Full input was:
  <<<<<<
           1: abcdef
  check:1     ^~~
  not:2          X~~
           2: ghijkl
  not:2       ~~~
  check:3        ^~~
           3: mnopqr
  not:4       X~~~~~
           4: stuvwx
  not:4       ~~~~~~
           5:
  eof:4       ^
  >>>>>>
  
  $ cat check5
  CHECK: abc
  CHECK-NOT: foobar
  CHECK: jkl
  CHECK-NOT: foobar
  
  $ cat input5
  abcdef
  ghijkl
  mnopqr
  stuvwx


Repository:
  rL LLVM

https://reviews.llvm.org/D53899

Files:
  llvm/include/llvm/Support/FileCheck.h
  llvm/lib/Support/FileCheck.cpp
  llvm/test/FileCheck/dump-input-annotations.txt
  llvm/utils/FileCheck/FileCheck.cpp

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D53899.171798.patch
Type: text/x-patch
Size: 5121 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20181030/8cf6ee9c/attachment.bin>


More information about the llvm-commits mailing list