Building a C++ Reflection System in One Weekend Using Clang and LLVM

Speaker: Arvid Gerstmann

Audience level: Intermediate | Advanced


Designing and building the runtime reflection system from tomorrow, today! With the introduction of libraries like LLVM and libclang, building custom tools for C++ is more approachable than it has ever been before. With Clang we have a fantastic tool to analyze and augment the C++ AST without writing our own compiler or parser. In this talk we'll go over the design and implementation of a runtime reflection system, demonstrating the use of Clang and the LLVM framework to craft custom C++ tools for your own needs. We'll be able to query the members of a class, inspect their types and size, as well as qualifiers and user-definable flags. To show-case a real-world usage of the solution, we'll add a way to easily serialize any class to or from a byte stream, by making use of the reflection information. The implementation is available under a permissive open-source license on Github (