[all-commits] [llvm/llvm-project] bd5cc6: [pseudo] Start rules are `_ := start-symbol EOF`, ...
Sam McCall via All-commits
all-commits at lists.llvm.org
Fri Aug 19 07:50:22 PDT 2022
Branch: refs/heads/main
Home: https://github.com/llvm/llvm-project
Commit: bd5cc6575bdbe1d091f1cc70fb7f0b3c07cb894b
https://github.com/llvm/llvm-project/commit/bd5cc6575bdbe1d091f1cc70fb7f0b3c07cb894b
Author: Sam McCall <sam.mccall at gmail.com>
Date: 2022-08-19 (Fri, 19 Aug 2022)
Changed paths:
M clang-tools-extra/pseudo/include/clang-pseudo/GLR.h
M clang-tools-extra/pseudo/lib/Forest.cpp
M clang-tools-extra/pseudo/lib/GLR.cpp
M clang-tools-extra/pseudo/lib/cxx/cxx.bnf
M clang-tools-extra/pseudo/lib/grammar/LRGraph.cpp
M clang-tools-extra/pseudo/test/lr-build-basic.test
M clang-tools-extra/pseudo/test/lr-build-conflicts.test
M clang-tools-extra/pseudo/unittests/ForestTest.cpp
M clang-tools-extra/pseudo/unittests/GLRTest.cpp
Log Message:
-----------
[pseudo] Start rules are `_ := start-symbol EOF`, improve recovery.
Previously we were calling glrRecover() ad-hoc at the end of input.
Two main problems with this:
- glrRecover() on two separate code paths is inelegant
- We may have to recover several times in succession (e.g. to exit from
nested scopes), so we need a loop at end-of-file
Having an actual shift action for an EOF terminal allows us to handle
both concerns in the main shift/recover/reduce loop.
This revealed a recovery design bug where recovery could enter a loop by
repeatedly choosing the same parent to identically recover from.
Addressed this by allowing each node to be used as a recovery base once.
Differential Revision: https://reviews.llvm.org/D130550
More information about the All-commits
mailing list