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

Joel E. Denny via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Feb 28 15:43:26 PST 2019


jdenny added a comment.

In D58784#1414106 <https://reviews.llvm.org/D58784#1414106>, @probinson wrote:

> FTR, the `CHECK: {{^$}}` is ensuring the first line is empty? I see that CHECK-EMPTY isn't allowed as the first directive, unfortunately.


This directive looks for the next empty line, even if that's not the first line.  Interestingly, when it's not the first directive, its search range starts after the previous match, so if the remainder of the previous match's line is empty (even if the full line is not empty), it'll match there.

The following appears to be equivalent to what an initial CHECK-EMPTY should do:

  CHECK: {{^}}
  CHECK-SAME: {{^$}}

Looking at the test suite, we also have what appears to be an equivalent to what an initial CHECK-NEXT should do (the "next" line is the first line in that case):

  CHECK: {{^}}
  CHECK-SAME: some text

Maybe we should just permit initial CHECK-NEXT and CHECK-EMPTY rather requiring people to use these hacks.

(Putting them after a CHECK-DAG is probably a mistake though.  Also, an initial CHECK-SAME has no clear meaning to me.)


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