[PATCH] D77227: [RFC][FileCheck] Require colon immediately after CHECK directives

Paul Robinson via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Apr 1 13:31:01 PDT 2020


probinson added a comment.

Okay, 1500+ tests to fix seems excessive.  Requiring CHECK directives to be on lines by themselves (with optional comment) is more restrictive than the LLVM test suite can tolerate.

I tried this: 
`git grep -I "CHECK\b" llvm\test | grep -v "CHECK.*:" | grep -v "RUN:" | wc -l`
which found 387 lines with the word CHECK not followed by a colon, and not on a RUN line.  That's just for the word CHECK, rather than actual check prefixes.  (The `-I` is, skip binary files.)  I captured the results and hand-edited out the commentary lines and other cases that were obviously not mistakes.
Final tally, 178

That's a really high false-positive rate, although I freely admit it's simplistic--many of the captured lines were using CHECK in a variable name and had some other prefix as the actual directive.

On the other hand, I just found 178 CHECK lines across 72 test files that are *probably* mistakes, and at least deserve a closer look.  That's a valuable test-validity tool, and it's hard to argue that we *shouldn't* have something like this.

>From the original description:

> The vast majority of false positives come from this diagnostic triggering on RUN lines,

If I leave out the filtering on "RUN:" then I get 10,660 hits, instead of 387.  So, if we want a diagnostic aid like this in FileCheck itself, it really needs to skip RUN: lines.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D77227





More information about the llvm-commits mailing list