What is starting point to extend clang RTTI features ?


I am working on many projects that's need RTTI for implementation; for
example JSON reader, writer, Database library, RESTFul and so on.

For that cases I use another languages like pascal and sometimes script
languages like PHP.

Now, I want to extend clang compiler RTTI to use it for that cases but
can't find starting point.

Please help me to find best starting point.

For first try to implement RTTI, I create a plugin to visit AST nodes
and extract functions and classes methods info to generate a header file
based on AST nodes, This header contain a map from a function/method
signature in string to pointer of that.

To complete my idea , I need help to solve two problem :

1- How to get pointer of overloaded methods and functions ?

An example:

template<typename T>
T sum(T a,T b) {
  return a + b;

int main(int argc, char const *argv[])
  return 0;

function extraction result is :

main (int argc, const char ** argv )
sum (int a, int b )
sum (double a, double b )

2- If a project contain more than one file how to generate a header for
all files ?


I am working on many projects that's need RTTI for implementation; for
example JSON reader, writer, Database library, RESTFul and so on.


I think it would be good if you can expand the description of your
use-case a bit to help people understand what you are looking for and

Are the projects you mention C++ projects? If so, can you explain why
you can't use the normal C++ RTTI support?

Best regards


To give you more information about the features of RTTI that I need, I
can explain one of my projects.

About two weeks ago I was working on an application that read Sketch
App (UI Design) file format and store file data to a tree of objects.

Sketch file is in JSON format,To read that file at first I should
write interface structures then for each property at least two line of
code should be written to set the object field. So I replace
RTTI instead of this complex codes.

In pascal we can define some properties for classes and set
value of those properties with RTTI. After define classes I write a JSON
reader that reads class_type property and it searches the class by
RTTI based on class_type property. then creates
an instance of that class.
each property that reads from the JSON set to the object instance that
created in previous step.

Create objects, read and set properties , type checkings and type
converting was done in one method because of RTTI.

C++ is my favorite lang, I want to improve it's RTTI.
Features I thinking about are a tree of namespaces, classes, structs,
methods, fields, functions and routines to search over tree , get and
set filed values and call methods and functions.

Hi again,

After many search around the web finally found many resources around
reflection and RTTI implementation in C++ and clang.

Some links about this topic :

I think it's not a easy task to do so I will go to read more about
reflection in other languages and implementations.