C++ Reflection via Clang LibTooling
summary
A Clang LibTooling-based tool parses the Clang AST and emits generated metadata headers that define a reflect function returning a specialization of a metadata_instance for each struct/class. The metadata fills a data_members tuple of name/reference bindings so code uses std::apply to run a recursive serialize that prints JSON. The tool consumes compile_commands.json plus file list, updates headers when types change, and supports nested types; future work targets richer AST nodes like namespaces and classes.
AI-written summary · about
chapters (9)
- 0:00Intro
- 0:18Abstract Syntax Tree
- 1:09Reflect function
- 1:25Generated meta_data_instance
- 1:58Writing a Serialization Method
- 3:20Tool Usage
- 3:42Modify vec3
- 4:13Modify main.cpp
- 4:31Applications
related talks
46mBuilding a C++ Reflection System in One Weekend Using Clang and LLVM
01h 37mReflection: Compile-Time Introspection of C++
01h 01mReflection
01h 08mKeynote: Reflection in C++26 - Welcome to v0.1 of the meta::[[verse]]!
24mRefactoring Legacy Codebases with LibTooling
01h 03mC++ Reflection: Back on Track
01h 04mWelcome to v1.0 of the meta::[[verse]]!
37mWelcome to v1.0 of the meta::[[verse]]!
