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

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


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

This patch implements input annotations for diagnostics that report
illegal matches for the directives CHECK-NEXT, CHECK-SAME, and
CHECK-EMPTY.  Instead of the usual `^~~`, which is used by later
patches for good matches, these annotations use `!~~` to mark the
illegal match ranges so that this category of errors is visually
distinct.

For example:

  $ FileCheck -v -dump-input=always check2 < input2 |& 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
  
  Input file: <stdin>
  Check file: check2
  
  Full input was:
  <<<<<<
          1: foo bar
  next:2         !~~
  >>>>>>
  
  $ cat check2
  CHECK: foo
  CHECK-NEXT: bar
  
  $ cat input2
  foo bar

If it seems like it might be difficult to remember which markers
indicate errors, keep in mind that errors and only errors are colored
red when colors are enabled.  Thus, `!~~` here is red.


Repository:
  rL LLVM

https://reviews.llvm.org/D53894

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: D53894.171792.patch
Type: text/x-patch
Size: 5787 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20181030/93155c38/attachment.bin>


More information about the llvm-commits mailing list