[clang] [llvm] [Clang-Repl] Introduce Error Recovery for Clang-Repl. (PR #223305)
via cfe-commits
cfe-commits at lists.llvm.org
Sun Oct 4 08:43:35 PDT 2026
================
@@ -54,6 +54,7 @@
namespace clang {
class ASTContext;
+class DeclStateReverter;
----------------
SahilPatidar wrote:
Are you talking about `PTUMutationAction` or `DeclStateReverter`?
I don’t think we should put everything into DeclUnmerger just because the current work involves some visitor-like dispatch. I don’t think the visitor approach fits cleanly here.
There are separate steps, and each step has its own responsibility with a reasonable level of separation. Also, DeclShape is not the completely same as Decl::kind.
Even if we used DeclKind directly, we would still need to implement the same dispatch separately. I also wouldn’t use DeclVisitor here because we are not performing one single operation for each declaration kind. Instead, there are separate operations, and each operation has its own dispatch.
PTUMutationAction starts the commit/restore and unlink operations, but these are separate operations. The commit operation itself also does two different things: it updates the mutated declaration state and registers the new declaration state (IsNew = true).
`DeclStateReverter` mainly provides a few privileged operations on a declaration. In that sense, it is more similar to ASTDeclMerger, which provides specific functionality that ASTDeclReader can use.
https://github.com/llvm/llvm-project/pull/223305
More information about the cfe-commits
mailing list