[PATCH] D52999: [FileCheck] Annotate input dump

George Karpenkov via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Oct 10 10:41:43 PDT 2018


george.karpenkov added a comment.

OK that's somewhat more clear, but I'm still somewhat confused. Line by line:

  $ FileCheck -v -dump-input=always checks1 < input1 |& sed -n '/^Key for/,$p'

I assume `sed` is there to suppress all output before the legend  is printed?

- Should legend be always printed? Wouldn't it make more sense to dump it only if requested?

  Key for input dump annotations:
  
    - L:     labels input line number L

In general, from your legend it's hard to figure out what line refers to what.
Here I assume that this item refers to line numbers from the matched files,
but it takes some guessing and looking at the output.

  - T:L    labels the only match result for a pattern of type T from line L
  - T:L'N  labels the Nth match result for a pattern of type T from line L

I do not understand what N'th match is.

  - ^~~    marks good match (requires -v)
  - !~~    marks bad match

I could not understand what "bad match" is, could only get it from a more detailed description later

  - X~~    marks search range when no match

"when no match is found" ?

  - ?      marks fuzzy match when no match

I don't understand this line. Is it a best-effort match when no match is found? Where the question mark is situated then?

  Detailed description of currently enabled markers:

Should the description of markers be always duplicated?

  - ^~~    marks the final match for an expected pattern
  - !~~    marks either:
           - the final match for an excluded pattern
           - the final but illegal match for an expected pattern

The explanation is not clear. What is "final"? It's better to clarify that excluded means supplied with "NOT".
It's not clear what "illegal" means here either.

  - X~~    marks the search range for an unmatched expected pattern

Where is X located? Just at the start of the range?

  - ?      marks a fuzzy match start for an otherwise unmatched pattern

What's the difference between `X` and a question mark?

  Full input was:
  <<<<<<
           1: ; abc def

Line numbering may become ambiguous with the input, especially the space after the colon.
Is line numbering required? Should there be a better separation?

  chk:1         ^~~

It's confusing that (from my understanding) line numbers above refer to line numbers in the input document,
but line numbers here refer to line numbers in the file with FileCheck directives.

  sam:2             ^~~

`sam` is not the best abbreviation for "SAME". Maybe spare another letter? Or use "sme" or something?

           2: ; ghI jkl
  nxt:3'0     X~~~~~~~~

I don't understand the semantics here. What's `'0`?
Why `X` is below the semicolon? If it's always at the start of the line, should it be there at all?

  nxt:3'1       ?

What is the purpose of this question mark? If we have already failed the search at this point because the previous pattern failed,
does it convey any information to put the question mark at the start of the line?
I don't understand what `'1` means here either.

  >>>>>>
  
  $ cat checks1
  CHECK: abc
  CHECK-SAME: def
  CHECK-NEXT: ghi
  CHECK-SAME: jkl
  
  $ cat input1
  ; abc def
  ; ghI jkl


https://reviews.llvm.org/D52999





More information about the llvm-commits mailing list