================
@@ -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
_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits