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

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


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

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

The brief description of annotations that's been included in the
output so far seems worthwhile either as an overview for someone new
to the annotations or as a quick reminder for someone who's already
familiar with them.  However, as the variety of diagnostics is getting
more complicated, and especially now that some markers are being used
for different kinds of related diagnostics, a detailed list of markers
with examples is becoming useful.  This list will be even more helpful
when -v, -vv, and colors affect which diagnostics and marker styles
are possible, and then this list will show only those that are
enabled.

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 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 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
  not:2         !~~~~~
  >>>>>>
  
  $ cat check3
  CHECK:     abc
  CHECK-NOT: foobar
  CHECK:     def
  
  $ cat input3
  abc foobar def


Repository:
  rL LLVM

https://reviews.llvm.org/D53896

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: D53896.171794.patch
Type: text/x-patch
Size: 12676 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20181030/fcd8ce24/attachment.bin>


More information about the llvm-commits mailing list