Manu343726 / siplasplas

A library for C++ reflection and introspection
https://manu343726.github.io/siplasplas
MIT License
195 stars 27 forks source link

Reflection mangling #19

Closed Manu343726 closed 8 years ago

Manu343726 commented 8 years ago

This is a first attempt to implement the basis needed to handle overloads (runtime demangling). The whole reflection parser was rewritten in a more modular way, and the AST processing should be now easily extensible. Also support for annotations on the C++ sourcecode was added, implementing C# attributes on top of them.

Manu343726 commented 8 years ago

Oh, sh.. I missed that "please rework" commit.

Manu343726 commented 8 years ago

Ignore the CI results, the build is broken since I introduced the Boost.Coroutine2 example (I don't know why the binary deps are different, it works on Windows). Also the make run-all-examples command may fail since the reflection example doesn't fulfill the contract (First param is -1, precondition says it should be > 0).

Manu343726 commented 8 years ago

GCC 5.3 ICEs when using ctti::type_id_t's hash as template parameter of Reflection template instead of the reflected type. I changed that from type to type id to be able to get all reflection data at compile-time given the class name.

For a class Class, the code generator writes a cpp::Reflection specialization like:

template<>
class Reflection<ctti::type_id<Class>().hash()>
{
    static cpp::MetaClassData& reflection()
    {
        ... // registration code, etc
    }
};

GCC segfaults when trying to instance the template above.