[cfe-dev] What is starting point to extend clang RTTI features ?

mohsen via cfe-dev cfe-dev at lists.llvm.org
Thu Dec 28 13:51:35 PST 2017


On Thu, 28 Dec 2017 14:17:10 +0330
mohsen <mohsen.timar at gmail.com> wrote:

> Hi
> 
> 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[])
{
	sum(1,2);
	sum(1.0,2.0);
	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 ?

-- 
Regards,
Mohsen Timar


More information about the cfe-dev mailing list