[PATCH] D125677: [pseudo] Remove the explicit Accept actions.

Sam McCall via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Tue Jun 7 05:51:21 PDT 2022


sammccall accepted this revision.
sammccall added a comment.
This revision is now accepted and ready to land.

This is a great simplification, thanks!



================
Comment at: clang-tools-extra/pseudo/lib/GLR.cpp:85
 
-  if (!PendingAccept.empty()) {
-    LLVM_DEBUG({
-      llvm::dbgs() << llvm::formatv("Accept: {0} accepted result:\n",
-                                             PendingAccept.size());
-      for (const auto &Accept : PendingAccept)
-        llvm::dbgs() << "  - " << G.symbolName(Accept.Head->Payload->symbol())
-                     << "\n";
-    });
-    assert(PendingAccept.size() == 1);
-    return *PendingAccept.front().Head->Payload;
-  }
+  const ForestNode *Result = nullptr;
+  StateID AcceptState = Params.Table.getGoToState(StartState, StartSymbol);
----------------
rather than mingling this with the glrReduce, I'd suggest collecting the set of final heads first and then analyzing them afterwards.

This means looping a second time, but I think the logic around recognizing patterns that look like `accept` might grow (e.g. if we want to incorporate some error tolerance)


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D125677



More information about the cfe-commits mailing list