[PATCH] D58784: [FileCheck]Remove assertions that prevent matching an empty string at file start before CHECK-NEXT/SAME

Paul Robinson via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Feb 28 22:14:26 PST 2019


probinson added a comment.

In D58784#1414574 <https://reviews.llvm.org/D58784#1414574>, @jdenny wrote:

> Here's how I see it, but I realize it's subjective.  If we say that an initial CHECK-SAME matches the first line, then, to be consistent with the relationship CHECK-SAME and CHECK-NEXT have everywhere else, an initial CHECK-NEXT should skip a new line and thus match the second line.  That means that, in order to match consecutive lines starting with the first line, we have:
>
>   CHECK-SAME: first line
>   CHECK-NEXT: second line
>   CHECK-NEXT: third line
>


That matches my intuition.

> But the following seems more intuitive to me:
> 
>   CHECK-NEXT: first line
>   CHECK-NEXT: second line
>   CHECK-NEXT: third line
> 
> 
> To say it more abstractly:
> 
> - CHECK-NEXT means match on the next line after the previous match.
> - CHECK-SAME means match on the same line as the previous match.
> 
>   If there is no previous match because this is the first directive, then that translates to:
> - CHECK-NEXT means match on the next line after no match yet, and that intuitively sounds like the first line to me.
> - CHECK-SAME means match on the same line as no match yet, but that sounds impossible to me.

I would say it this way:

- CHECK-NEXT means match on the next line after the starting point
- CHECK-SAME means match on the same line as the starting point

which is more in line with the search-range model.


Repository:
  rL LLVM

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

https://reviews.llvm.org/D58784





More information about the llvm-commits mailing list