[llvm] [FileCheck]: Fix diagnostics for NOT prefixes (PR #78412)

Thomas Preud'homme via llvm-commits llvm-commits at lists.llvm.org
Thu Jan 18 06:35:58 PST 2024


================
@@ -2344,13 +2350,13 @@ size_t FileCheckString::CheckDag(const SourceMgr &SM, StringRef Buffer,
   // group, so we don't use a range-based for loop here.
   for (auto PatItr = DagNotStrings.begin(), PatEnd = DagNotStrings.end();
        PatItr != PatEnd; ++PatItr) {
-    const Pattern &Pat = *PatItr;
+    const Pattern &Pat = PatItr->DagNotPat;
     assert((Pat.getCheckTy() == Check::CheckDAG ||
             Pat.getCheckTy() == Check::CheckNot) &&
            "Invalid CHECK-DAG or CHECK-NOT!");
 
     if (Pat.getCheckTy() == Check::CheckNot) {
-      NotStrings.push_back(&Pat);
+      NotStrings.emplace_back(Pat, PatItr->DagNotPrefix);
----------------
RoboTux wrote:

Why not make NotString a std::vector<DagNotPrefixInfo *> and just push_back(&*PatItr)? It avoids creating a new instance here as well.

https://github.com/llvm/llvm-project/pull/78412


More information about the llvm-commits mailing list