[clang] [llvm] [Clang-Repl] Introduce Error Recovery for Clang-Repl. (PR #223305)

Jared Wyles via cfe-commits cfe-commits at lists.llvm.org
Sun Nov 1 23:34:15 PST 2026


================
@@ -54,6 +54,7 @@
 namespace clang {
 
 class ASTContext;
+class DeclStateReverter;
----------------
jaredwy wrote:

No need for a selection on action. VisitX on the Unmerger has one meaning: What do we do with this decl. `bool isDiscarded(const Decl *D) const { return Ledger.isFromThisPTU(D, ID); }` other wise write its footprint back. VisitTagDecl does both halves today. The only condition is provenance, a property of the decl, not of the caller. Rec is a member set before Visit, like Record on ASTDeclReader.

Commit never enters that visitor. It needs one private read, data(), which becomes a snapshot primitive on the Unmerger; every other footprint is public getters. So the commit-side dispatch doesn't need friends PTUMutationActions can be a ConstDeclVisitor and commitClass its VisitCXXRecordDecl.

So yes you are right PTUMutationActions picks the operation and delegates the privileged work to the Unmerger. “One class” was the friend grant, not the visitor count. Two visitors, one friend. And restore() isn’t a new caller — it’s what CleanUpPTU turns into, which is where my PTURollbackGuard comment was going.

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


More information about the cfe-commits mailing list