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

Nhat Nguyen via cfe-commits cfe-commits at lists.llvm.org
Thu Oct 23 14:07:02 PDT 2025


================
@@ -5501,6 +5493,55 @@ class BuiltinBitCastExpr final
   }
 };
 
+/// Represents a C++2c reflect expression (P2996).
+class CXXReflectExpr : public Expr {
+
+  // Source locations.
+  SourceLocation OperatorLoc;
+  SourceRange OperandRange;
+
+  CXXReflectExpr(const ASTContext &C, QualType T, QualType Ty);
+  CXXReflectExpr(const ASTContext &C, QualType T, Decl *Arg, bool IsNamespace);
+  CXXReflectExpr(EmptyShell Empty);
+
+public:
+  static CXXReflectExpr *Create(ASTContext &C, SourceLocation OperatorLoc,
+                                SourceLocation ArgLoc, QualType Operand);
+
+  static CXXReflectExpr *Create(ASTContext &C, SourceLocation OperatorLoc,
----------------
changkhothuychung wrote:

For now, the top one I create to use for parsing builtin types, it may be extended to parse other type-id's in upcoming PRs. The other one I use for parsing global namespace for now, but I think it could be extended in upcoming PRs for other kinds, e.g, namespace name. 

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


More information about the cfe-commits mailing list