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

Nhat Nguyen via cfe-commits cfe-commits at lists.llvm.org
Mon Apr 13 14:05:51 PDT 2026


================
@@ -10936,6 +10939,46 @@ bool PointerExprEvaluator::VisitCXXNewExpr(const CXXNewExpr *E) {
 
   return true;
 }
+
+//===----------------------------------------------------------------------===//
+// Reflection expression evaluation
+//===----------------------------------------------------------------------===//
+
+namespace {
+class ReflectionEvaluator
----------------
changkhothuychung wrote:

yeah there is already code to handle that, but those functions are in the base class ExprEvaluatorBase. Its a CTRP class template so we will need a derived class for it. Currently I have this code in the test file 

```cpp
template <auto R>
consteval auto f1() {
  return R;
}

static_assert(f1<^^int>() == ^^int);
```

So I believe the LHS will hit `EvaluateReflection` since the deduced return type is MetaInfo, and then the call to `ReflectionEvaluator(Info, Result).Visit(E)` will hit `VisitCallExpr` in the base class `ExprEvaluatorBase`.  Without having the class ReflectionEvaluator like currently, I believe we will have to repeat the work of ExprEvaluatorBase member functions in our function. Is there another way to handle this without inheriting the base class ExprEvaluatorBase? 



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


More information about the cfe-commits mailing list