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

James Henderson via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Mar 8 01:39:34 PST 2019


jhenderson added a comment.

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

> OK sounds like we should invent a CHECK-FIRSTLINE directive.  (Let's not call it CHECK-FIRST because people could think it means "do these first before other checks.")  It must be the first directive, and its pattern must match on the first line of input (before the first newline).
>  Does that satisfy the requirements?


I think it would for this case, yes. I think the assertions still need removing though, since we can reach them still (e.g. via empty matches, which CHECK-FIRSTLINE doesn't prevent, since people aren't forced to use it - in fact, I suspect a basic implementation of it could itself cause the same assertion, due to somebody writing something like `CHECK-FIRSTLINE: {{(Possible Prefix)?}}`) followed by a CHECK-SAME or CHECK-NEXT.

One question about CHECK-FIRSTLINE - is it required to be the first CHECK in the file? In other words, to check two different things on the first line, would the following be allowed:

  CHECK-FIRSTLINE: some stuff
  CHECK-FIRSTLINE: more stuff

I don't think it needs to be, because the following would make sense to me:

  CHECK-FIRSTLINE: some stuff
  CHECK-SAME: more stuff

But the latter has the downside that, using multiple check prefixes, I can't say something like "check that the first line starts with some blob in one version, followed by the second blob, but in the second blob, only check for the latter", i.e. neither of the following would work:

  V1ONLY-FIRSTLINE: some stuff
  BOTH-SAME: more stuff

  V1ONLY-FIRSTLINE: some stuff
  BOTH-FIRSTLINE: more stuff


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