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

via cfe-commits cfe-commits at lists.llvm.org
Fri Oct 30 21:19:21 PDT 2026


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

My concern has always been about the friend-access mechanism, not whether we have one class or multiple classes.

`DeclStateReverter` and its protected-access workaround were just temporary solutions until we found a better way to handle friendship. My original concern was whether we should have one friend class or multiple friend classes. I have no issue with having multiple classes.

As I mentioned earlier, we could have three separate classes for Commit, Restore, and Unmerge What I meant in my previous comment was something like this https://gist.github.com/SahilPatidar/cf409bc6e4aa5f7ca6e133fac1273253. This way, the individual classes can use what they need without asking another class to expose even small helpers like isDeclXValid(D).

I’m fine with either approach. We can have separate ASTDeclCommitter, ASTDeclRestorer, and ASTDeclUnmerger classes with the required friend access, or one shared class to provide access to them.

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


More information about the cfe-commits mailing list