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

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


jdenny created this revision.
Herald added subscribers: kristina, hiraditya.

This patch implements input annotations for diagnostics reporting
CHECK-DAG discarded matches.  These diagnostics are enabled by -vv.
These annotations mark discarded match ranges using `!~~` because they
are bad matches even though they are not errors.

CHECK-DAG discarded matches create another case where there can be
multiple match results for the same directive.

For example:

  $ FileCheck -vv -dump-input=always check4 < input4 |& 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 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: check4
  
  Full input was:
  <<<<<<
           1: abcdef
  dag:1       ^~~~
  dag:2'0       !~~~
           2: cdefgh
  dag:2'1     ^~~~
  check:3         X~
  >>>>>>
  
  $ cat check4
  CHECK-DAG: abcd
  CHECK-DAG: cdef
  CHECK: efgh
  
  $ cat input4
  abcdef
  cdefgh

This shows that the line 3 CHECK fails to match even though its
pattern appears in the input because its search range starts after the
line 2 CHECK-DAG's match range.  The trouble might be that the line 2
CHECK-DAG's match range is later than expected because its first match
range overlaps with the line 1 CHECK-DAG match range and thus is
discarded.

Because `!~~` for CHECK-DAG does not indicate an error, it is not
colored red.  Instead, when colors are enabled, it is colored cyan,
which suggests a match that went cold.


Repository:
  rL LLVM

https://reviews.llvm.org/D53898

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: D53898.171797.patch
Type: text/x-patch
Size: 4513 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20181030/122cf026/attachment.bin>


More information about the llvm-commits mailing list