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

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


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

This patch implements input annotations for diagnostics that suggest
fuzzy matches for directives for which no matches were found.  Instead
of using the usual `^~~`, which is used by later patches for good
matches, these annotations use `?` so that fuzzy matches are visually
distinct.  No tildes are included as these diagnostics (independently
of this patch) currently identify only the start of the match.

For example:

  $ FileCheck -v -dump-input=always check1 < input1 |& 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
    - X~~    marks search range when no match is found
    - ?      marks fuzzy match when no match is found
  
  Input file: <stdin>
  Check file: check1
  
  Full input was:
  <<<<<<
            1: ; abc def
            2: ; ghI jkl
  next:3'0     X~~~~~~~~
  next:3'1       ?
  >>>>>>
  
  $ cat check1
  CHECK: abc
  CHECK-SAME: def
  CHECK-NEXT: ghi
  CHECK-SAME: jkl
  
  $ cat input1
  ; abc def
  ; ghI jkl

This patch introduces the concept of multiple "match results" per
directive.  In the above example, the first match result for the
CHECK-NEXT directive is the failed match, for which the annotation
shows the search range.  The second match result is the fuzzy match.
Later patches will introduce other cases of multiple match results per
directive.

When colors are enabled, `?` is colored magenta.  That is, it doesn't
indicate the actual error, which a red `X~~` marker indicates, but its
color suggests it's closely related.


Repository:
  rL LLVM

https://reviews.llvm.org/D53893

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: D53893.171790.patch
Type: text/x-patch
Size: 10565 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20181030/bd2dcb3a/attachment.bin>


More information about the llvm-commits mailing list