This is an archive of the discontinued LLVM Phabricator instance.

[FileCheck] Annotate input dump (4/7)
ClosedPublic

Authored by jdenny on Oct 30 2018, 2:14 PM.

Details

Summary

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

For example:

$ FileCheck -dump-input=help
The following description was requested by -dump-input=help to
explain the input annotations printed by -dump-input=always and
-dump-input=fail:

  - L:     labels line number L of the input file
  - 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, such as:
           - CHECK-NEXT on same line as previous match (error)
           - CHECK-NOT found (error)
  - X~~    marks search range when no match is found, such as:
           - CHECK-NEXT not found (error)
  - ?      marks fuzzy match when no match is found
  - colors error, fuzzy match

If you are not seeing color above or in input dumps, try: -color

$ FileCheck -v -dump-input=always check3 < input3 |& sed -n '/^<<<</,$p'
<<<<<<
       1: abc foobar def
not:2         !~~~~~     error: no match expected
>>>>>>

$ cat check3
CHECK:     abc
CHECK-NOT: foobar
CHECK:     def

$ cat input3
abc foobar def

Diff Detail

Repository
rL LLVM

Event Timeline

jdenny created this revision.Oct 30 2018, 2:14 PM
jdenny updated this revision to Diff 173047.Nov 7 2018, 3:13 PM

Rebased onto updated patches earlier in series.

jdenny updated this revision to Diff 174787.Nov 20 2018, 8:51 AM

Update for changes earlier in patch series.

jdenny updated this revision to Diff 176901.Dec 5 2018, 4:43 PM
jdenny edited the summary of this revision. (Show Details)
jdenny set the repository for this revision to rL LLVM.

Propagate changes started earlier in patch series.

jdenny updated this revision to Diff 177384.Dec 7 2018, 10:14 PM
jdenny edited the summary of this revision. (Show Details)

Continue changes started earlier in patch series.

probinson accepted this revision.Dec 12 2018, 10:58 AM

These get to be pretty mechanical after a while, don't they? I was wondering how hard it would be for someone else, next time somebody wants to add a new directive kind, but it seems like not really a big deal and that's a good thing.
Again a comment needs fixing but otherwise LGTM.
I'll try to get to the rest tomorrow.

llvm/include/llvm/Support/FileCheck.h
167 ↗(On Diff #177384)

Comments should be proper sentences.

This revision is now accepted and ready to land.Dec 12 2018, 10:58 AM

Thanks, Paul!

jdenny updated this revision to Diff 177941.Dec 12 2018, 3:11 PM
jdenny set the repository for this revision to rL LLVM.

Adjust comment, as suggested by probinson.

jdenny marked an inline comment as done.Dec 12 2018, 3:19 PM
This revision was automatically updated to reflect the committed changes.