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

Paul Robinson via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Apr 2 08:39:04 PDT 2020


probinson added a comment.

After sleeping on it....

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

> I wouldn't get fancy about aligning delimiters with file types; the set is pretty small, basically `# // ;` should cover essentially everything.


It would simplify the check if we looked for single-character delimiters, so `/` instead of `//` for C++ (which incidentally also covers Rust and C++-style comments in C).  I'm fairly sure Objective-C[++] doesn't add new comment characters.

There are Clang .c tests that use `/* CHECK` so we should add `*` to the list.  Julia uses `#` which is already on the list.  The flang project is coming so we should be ready for Fortran; historically that used `C` in column 1, but the language has evolved and `!` is now common.  I think it's reasonable to require Fortran tests to use the `!` comment delimiter, although it would be courteous to get the flang people to say okay.  Are there other cases we should consider?

The text-preceding-the-directive would then have to be either whitespace or arbitrary text ending with `[#/;*!]` which is easy to express with a regex.

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.

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.


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