[clang] [lldb] [clang]: support std::meta::info for primitive types (PR #190356)

Nhat Nguyen via cfe-commits cfe-commits at lists.llvm.org
Mon Aug 3 13:00:43 PDT 2026


================
@@ -11220,6 +11223,57 @@ bool PointerExprEvaluator::VisitCXXNewExpr(const CXXNewExpr *E) {
 
   return true;
 }
+
+//===----------------------------------------------------------------------===//
+// Reflection expression evaluation
+//===----------------------------------------------------------------------===//
+
+namespace {
+class ReflectionEvaluator : public ExprEvaluatorBase<ReflectionEvaluator> {
+
+  using BaseType = ExprEvaluatorBase<ReflectionEvaluator>;
+
+  APValue &Result;
+
+public:
+  ReflectionEvaluator(EvalInfo &E, APValue &Result)
+      : ExprEvaluatorBaseTy(E), Result(Result) {}
+
+  bool Success(const APValue &V, const Expr *E) {
+    Result = V;
+    return true;
+  }
+
+  bool VisitCXXReflectExpr(const CXXReflectExpr *E);
+  bool ZeroInitialization(const Expr *E);
+};
+
+bool ReflectionEvaluator::VisitCXXReflectExpr(const CXXReflectExpr *E) {
+  switch (E->getKind()) {
+  case ReflectionKind::Null: {
+    APValue ReflectionValue(ReflectionKind::Null, /*Operand=*/nullptr);
+    return Success(ReflectionValue, E);
+  }
----------------
changkhothuychung wrote:

thanks for flagging this! so since null reflection cant be constructed as a result of parsing `^^`, and `CXXReflecExpr` is the AST node for parsing reflection. Then the `Reflection::Null` case in any function which takes a `CXXReflectExpr` as a variable should be unreachable. I updated to provide an assert for it. 

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


More information about the cfe-commits mailing list