Should FileCheck report incorrect prefixes?

There is an option –allow-unused-prefixes in FileCheck that checks whether prefix specified by --check-prefix or --check-prefixes is used in file, but what I think is missing is some kind of option/config to detect opposite situation - whether prefix in the file is declared in any RUN line.

At the moment we can have lit tests that contain “CHECK” lines that doesn’t check anything because given prefix is not used by any of RUN lines. I don’t think it is an error in itself, but it would be nice to get at least warning info when running lit test that such prefix exists. And this issue can be as I see now due to two reasons:

  1. RUN line has been removed and given prefix is no longer required

  2. Typo in prefix spelling when writing CHECK line

Is it something by design, or do you think it is worth updating?

The problem is how to know what is a FileCheck prefix use: Lit keywords look like FileCheck prefix uses. Plain English comments or code containing : can look like FileCheck prefix uses. This paragraph looks like a use of a FileCheck prefix named use.

I developed a script to help find them, but it’s not pretty: ⚙ D91191 WIP: [FileCheck] Add undefined prefix report tool

A fix is to have some standard FileCheck prefix format that’s not likely to collide with any other text. For example, see the CHECK-IF(expr): idea in the above review.

Thanks for the script.

Good point with regards to mixing prefixes match with false-positives that might be caused by regular text in the tests. I haven’t thought of that. The idea with CHECK-IF(expr) seems like a good option to resolve such issue.