[PATCH] D158164: [FileCheck] Added --match-full-lines-leading and --match-full-lines-trailing option

Joel E. Denny via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Aug 18 08:27:49 PDT 2023


jdenny added a comment.

In D158164#4598113 <https://reviews.llvm.org/D158164#4598113>, @jhenderson wrote:

> In D158164#4595420 <https://reviews.llvm.org/D158164#4595420>, @strimo378 wrote:
>
>> --match-full-lines is require to check that nothing trailing is missing. Current approach is to add in 100 lines {{$}}
>
> Okay, I think I see your point. You are simply looking to find a way to apply that regex pattern to every line, much like `--match-full-lines` adds an implicit `{{^}}` and `{{$}}` around each line. Is that correct? And you don't want to use `--match-full-lines` because of the noisy prefixes (hence I'm not sure @MaskRay's suggestion will work).
>
> I'm not strongly opposed to the new options.

On one hand, I want to argue this patch will contribute to the difficulty of writing careful FileCheck directives because, when looking at a FileCheck pattern, there would be even more possible strictness levels that might be in effect.  I already get confused when moving among tests: sometimes I think I still have the strictness of `-match-full-lines` or `-strict-whitespace` as I saw in the last test, but in the test I'm currently editing I don't, so I accidentally write a weak pattern.

On the other hand, this patch might encourage people to make tests more strict.  They might not if strictness requires extending hundreds of lines with `{{^}}`, `{{$}}`, or `{{.*}}` (useful when `-match-full-lines` is already in effect but the start/end of a line is not interesting).

At least the implementation is simple.

> However, they should be a) documented,

And tested in lit's own test suite.

> and b) I think the names are wrong, since they contradict themselves - trailing only means not "full-lines". I would suggest that the names might be `--match-leading-lines` and `--match-trailing-lines` or something to that effect.

Agreed except those names confuse me too.  :-)  It sounds like matching multiple leading/trailing lines in a file.

Maybe `-strict-line-start` and `-strict-line-end`?


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D158164



More information about the llvm-commits mailing list