bloomberg / clang-p2996

Experimental clang support for WG21 P2996 (Reflection).
https://github.com/bloomberg/clang-p2996/tree/p2996/P2996.md
51 stars 8 forks source link

Represent expression results as APValues #74

Closed katzdm closed 1 month ago

katzdm commented 1 month ago

The use of ConstantExpr to represent an RK_expr_result-kind ReflectionValue was a misstep, born from a misunderstanding of the purpose of ConstantExpr during early days of this fork. The difficulty with representing RK_expr_result as an APValue is that a naive implementation will introduce a circular dependency between the data layouts of ReflectionValue and APValue. It ought to be possible to work around this, though. This ought to both create opportunities to reduce the number of unnecessary AST nodes created, and to unwind the weird and brittle hack of supporting ConstantExprs that lack an underlying SubExpr.