[PATCH] D77607: [FileCheck] Fix --dump-input annotation sort per input line

Joel E. Denny via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Apr 8 11:24:12 PDT 2020


jdenny marked an inline comment as done.
jdenny added inline comments.


================
Comment at: llvm/test/FileCheck/dump-input-annotations.txt:586-599
 ;         IMPNOT:<<<<<<
 ;    IMPNOT-NEXT:          1: hello world again!
 ;  IMPNOT-V-NEXT:check:1      ^~~
 ; IMPNOT-VV-NEXT:not:imp1     X
 ; IMPNOT-VV-NEXT:not:imp2     X
 ; IMPNOT-VV-NEXT:not:imp3     X
+;  IMPNOT-V-NEXT:check:2            ^~~
----------------
thopre wrote:
> With 3 CHECK directives, I would expect 4 blocks of implicit checks being tested:
> 
>   #   - before directive 1
>   #   - between directive 1 and directive 2
>   #   - between directive 2 and directive 3
>   #   - after directive 3
> 
> Unless I misunderstood, I would expect directive #3 to fail, i.e. "again" is found between "wor" and '!'. However the implicit check that fail is shown after the third CHECK directive.
After applying this patch, the annotations per input line are listed in the order FileCheck produces them (that is, temporal order).  First, FileCheck matches check:1 (the first CHECK directive), as show in the annotation on test file line 588.  Then...

> With 3 CHECK directives, I would expect 4 blocks of implicit checks being tested:
> 
>     - before directive 1

... FileCheck searches for the implicit patterns here.  However, here is the empty string before "hello", so the search range for each implicit pattern is just an "X", as show in the annotations on test file lines 589-591.

Next, FileCheck matches check:2, as shown on test file line 592, and then...

>     - between directive 1 and directive 2

... FileCheck searches for the implicit patterns here, as shown in the annotations on test file lines 593-595.

Next, FileCheck matches check:3, as shown on test file line 596, and then...

>     - between directive 2 and directive 3

... FileCheck searches for the implicit patterns here, as shown in the annotations on test file lines 597-599.  The third implicit pattern matches, and that's an error, so FileCheck terminates.

Thus, FileCheck never tries to match EOF, and...

>     - after directive 3

... FileCheck never tries to match the implicit patterns here.

> 
> Unless I misunderstood, I would expect directive #3 to fail, i.e. "again" is found between "wor" and '!'.

That's what happened.

> However the implicit check that fail is shown after the third CHECK directive.

Because FileCheck doesn't know where to look for the implicit patterns until after matching the next CHECK directive.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D77607/new/

https://reviews.llvm.org/D77607





More information about the llvm-commits mailing list