[PATCH] D86315: Test all CHECK-NOT in a block even if one fails

Thomas Preud'homme via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Aug 20 13:12:09 PDT 2020


thopre created this revision.
thopre added reviewers: jhenderson, jdenny, probinson, grimar, arichardson.
thopre added a project: LLVM.
Herald added a subscriber: hiraditya.
thopre requested review of this revision.

This commit makes FileCheck print all CHECK-NOT directive failure in a
CHECK-NOT block even if one fails. Prior to that, it would stop trying
to match CHECK-NOT directive as soon as one in the block fails.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D86315

Files:
  llvm/lib/Support/FileCheck.cpp


Index: llvm/lib/Support/FileCheck.cpp
===================================================================
--- llvm/lib/Support/FileCheck.cpp
+++ llvm/lib/Support/FileCheck.cpp
@@ -2197,6 +2197,7 @@
                                const std::vector<const Pattern *> &NotStrings,
                                const FileCheckRequest &Req,
                                std::vector<FileCheckDiag> *Diags) const {
+  bool DirectiveFail = false;
   for (const Pattern *Pat : NotStrings) {
     assert((Pat->getCheckTy() == Check::CheckNot) && "Expect CHECK-NOT!");
 
@@ -2212,11 +2213,11 @@
 
     PrintMatch(false, SM, Prefix, Pat->getLoc(), *Pat, 1, Buffer, Pos, MatchLen,
                Req, Diags);
-
-    return true;
+    DirectiveFail = true;
+    continue;
   }
 
-  return false;
+  return DirectiveFail;
 }
 
 size_t FileCheckString::CheckDag(const SourceMgr &SM, StringRef Buffer,


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D86315.286888.patch
Type: text/x-patch
Size: 892 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20200820/78abae7d/attachment.bin>


More information about the llvm-commits mailing list