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

Jonathan Roelofs via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Apr 2 11:55:59 PDT 2020


jroelofs updated this revision to Diff 254562.
jroelofs added a comment.

Draft of paulr/jdenny's fuzzy-comment-prefix filter idea.

In D77227#1957332 <https://reviews.llvm.org/D77227#1957332>, @probinson wrote:

> After sleeping on it....


snip

> I believe where we're headed is that the (whitespace or ending with `[#/;*!]`) rule is how we'll identify directives that we expect the user *intended* to be directives for FileCheck to act on.  If we then find syntactic errors (multiple suffixes, missing colon) we'll report those as errors.

Fantastic idea. This rule seems to have a really good signal/noise ratio on this class of bug, at least for llvm/tests.

The diagnostic in this patch triggers 186 times in the suite of 36125 tests in llvm/test. Most of them are true positives, though there are ~45 false-positives that seem easy to work around by rewording the comments:

  llvm/test/CodeGen/X86/fp-intrinsics.ll:922
  llvm/test/CodeGen/X86/avx-cast.ll:27
  llvm/test/CodeGen/Mips/mips64muldiv.ll

> Would it be useful to have one of the verbose modes report directive matches that *don't* satisfy the (whitespace or `[#/;*!]`) rule?  It would report all the false positives, but could be really helpful in diagnosing a malfunctioning test.  And it would be easy to add this, as we've already analyzed the line to see if it's one we should act on.

Another approach would be to always emit them as warnings, and conditionally elevate that to a hard failure with a -Werror flag.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D77227

Files:
  llvm/include/llvm/Support/FileCheck.h
  llvm/lib/Support/FileCheck.cpp
  llvm/utils/FileCheck/FileCheck.cpp

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D77227.254562.patch
Type: text/x-patch
Size: 7285 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20200402/97fcbe04/attachment.bin>


More information about the llvm-commits mailing list