[PATCH] D130523: [pseudo] Perform unconstrained recovery prior to completion.

Haojian Wu via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Thu Jul 28 07:01:18 PDT 2022


hokein accepted this revision.
hokein added inline comments.
This revision is now accepted and ready to land.


================
Comment at: clang-tools-extra/pseudo/include/clang-pseudo/grammar/LRTable.h:109
+    // tok::unknown is a sentinel value used in recovery: can follow anything.
+    if (tok::unknown)
+      return true;
----------------
this `if` doesn't make sense, and is not needed, I think. 


================
Comment at: clang-tools-extra/pseudo/lib/GLR.cpp:621
     // Consume the token.
     glrShift(Heads, Terminals[I], Params, Lang, NextHeads);
 
----------------
I think we can move the Line634 `Heads.resize(HeadsPartition)` before the `glrShift()` as we only do shift on the nearly-created heads, we might gain some performance back.


================
Comment at: clang-tools-extra/pseudo/lib/GLR.cpp:649
+    HeadsPartition = NextHeads.size();
     Reduce(NextHeads, Lookahead);
     // Prepare for the next token.
----------------
Can we have some comments on `GLRReduce::operator()` on how does parameter `Head` get modified  (new heads are appended to it)?  


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D130523



More information about the cfe-commits mailing list