[PATCH] D78024: [FileCheck] - Fix the false positive when -implicit-check-not is used with an unknown -check-prefix.

George Rimar via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Apr 15 04:53:50 PDT 2020


grimar added inline comments.


================
Comment at: llvm/lib/Support/FileCheck.cpp:1375-1377
+  // We do not allow using -implicit-check-not when an explicitly specified
+  // check prefix is not present in the input buffer.
+  if ((Req.IsDefaultCheckPrefix || FoundUsedPrefix) && !DagNotMatches.empty()) {
----------------
jdenny wrote:
> I find this logic confusing.  Its goal appears to be to constrain when `DagNotMatches` are added to `CheckStrings`.  However, the real goal is to constrain when FileCheck complains that there are no used prefixes.  Would the following logic work?
> 
> ```
> if (!FoundUsedPrefix && (ImplicitNegativeChecks.empty() || !Req.IsDefaultCheckPrefix)) {
>   errs() << "error: no check strings found with prefix"
>   . . .
> }
> if (!DagNotMatches.empty()) {
>   CheckStrings->emplace_back(
>   . . .
> }
> ```
This looks better and works, thanks!

(The code above has `DagNotMatches = ImplicitNegativeChecks;` line which is also a bit confusing probably)


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

https://reviews.llvm.org/D78024





More information about the llvm-commits mailing list