You might consult Andrew Sutton et al. work at https://gitlab.com/lock3/clang.
If you seek to do something different from what they’re doing, you’ll want to define two different kinds of AST Expr nodes: the first covers your entry-point reflections , i.e. the result of reflexpr(x) for various kinds of x’s (e.g. CXXReflectExpr - they define it to work with typename, template name, etc. operands); the second are queries on an existing reflection to produce another reflection or a primitive (e.g. CXXReflectionReadQueryExpr).
I recommend you do keyword searches on their code to trace how they get from the parsing of the reflexpr keyword to the final evaluation in lib/AST/ExprConstant.cpp.
The basic lifetime/processing of an AST Expression node:
ParseXYZ() →
Sema::ActOnXYZ(…) →
[TransformXYZ(…) → ActOnXYZ(…) while still dependent ->]
ExprEvaluator::EvaluateXYZ(…)
First, though, perhaps consider your goals, as I’m not 100% sure the Reflection TS is the last word on the subject of reflection — though others certainly disagree with me. Are you simply anxious to get reflection support for use in your own code? Perhaps instead look into writing your own clang tools to perform ersatz “metaprogramming” tasks (generating new source files, etc.) using “reflected” info from the AST. It’s not an ideal approach, but until all the debates are resolved surrounding reflection, it’s the most dependable and powerful approach, and there’s already plenty of support.
Best of luck,
Dave