[clang] [clang]: reflection operator parsing for global namespace and primitive types (PR #164692)

via cfe-commits cfe-commits at lists.llvm.org
Thu Oct 23 08:27:44 PDT 2025


================
@@ -1939,6 +1939,43 @@ TypeTraitExpr *TypeTraitExpr::CreateDeserialized(const ASTContext &C,
   return new (Mem) TypeTraitExpr(EmptyShell(), IsStoredAsBool);
 }
 
+CXXReflectExpr::CXXReflectExpr(const ASTContext &C, QualType T, QualType Ty)
+    : Expr(CXXReflectExprClass, T, VK_PRValue, OK_Ordinary) {}
+
+CXXReflectExpr::CXXReflectExpr(const ASTContext &C, QualType T, Decl *Arg,
+                               bool IsNamespace)
+    : Expr(CXXReflectExprClass, T, VK_PRValue, OK_Ordinary) {}
----------------
Sirraide wrote:

Hmm, the main thing I’m worried about is that the persisting part might get a bit complicated: it’s one thing if it’s at the top-level, but if you have some deeply nested struct that has a reflexion member, you’d have to rebuild (or at least traverse) the entire `APValue`—and you’d have to either do that in any case or come up w/ some system to keep track of whether this traversal to potentially rebuild the `APValue` is necessary for the result of any particular constant evaluation, which is yet more work that we’d have to do... so considering all that I’m more leaning towards just persisting any nested `APValue`s unconditionally.


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


More information about the cfe-commits mailing list