A C++ reflection library that uses Clang to parse source code and generate runtime type information databases.
clReflect is a C++ reflection library that uses the Clang compiler to parse C++ source code and generate runtime type information databases. It solves the problem of enabling runtime introspection and manipulation of C++ types, which is not natively supported by the language, facilitating tasks like serialization, scripting, and dynamic object creation.
C++ developers working on projects that require runtime type information, such as game engines, serialization frameworks, or tools needing dynamic code inspection and manipulation.
Developers choose clReflect because it leverages Clang for accurate C++ parsing, supports modern standards, and generates efficient binary databases for fast runtime access, avoiding the overhead of runtime parsing while providing comprehensive reflection capabilities.
C++ Reflection using clang
Open-Awesome is built by the community, for the community. Submit a project, suggest an awesome list, or help improve the catalog on GitHub.
Leverages Clang compiler infrastructure to parse C++ source code accurately, supporting modern standards like C++17 and compiler-specific extensions, as shown in the README's command-line examples.
Generates binary databases that can be memory-mapped for fast loading and provide constant-time type lookups via hash-based functions, avoiding runtime parsing overhead.
Supports linking reflected functions with actual addresses by parsing compiler-generated MAP files, enabling dynamic function calls for scripting or serialization.
Allows forwarding of compiler flags to Clang through clscan, ensuring compatibility with various build settings and platforms, as demonstrated with MSVC-specific options.
Requires running multiple command-line tools (clscan, clmerge, clexport) in sequence and manual code generation, which can be cumbersome and error-prone for integration into build systems.
Full function reflection relies on parsing MAP files, which may not be consistently available across all compilers or platforms, limiting portability and ease of use.
C++ primitives and types need explicit marking with reflection specs or attributes, adding boilerplate code and maintenance overhead, especially in large or legacy codebases.