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

Jared Wyles via cfe-commits cfe-commits at lists.llvm.org
Fri Oct 30 02:48:49 PDT 2026


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

On the friend question specifically. There's one real grant in the diff, `CXXRecordDecl` -> `DeclStateReverter` for `DefinitionData`. Everything else goes through `struct XAccess : Base { using Base::M; }` and a `static_cast` to it, eight times. That cast is UB when the object isn't an `XAccess`, and `Decl` is polymorphic so `-fsanitize=vptr` will catch it. Those eight structs are the friend list you're avoiding, and `ASTDeclUnmerger` already has two of them (`Redeclarable`, `CXXRecordDecl`). That's the other half of what I meant by extending the access and using friends. `classifyShape` is also a fourth partition on top of the three above.

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


More information about the cfe-commits mailing list