This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
The AST tree modification.
- From: niXman <i dot nixman at gmail dot com>
- To: gcc at gcc dot gnu dot org
- Date: Tue, 4 Oct 2011 02:47:21 +0400
- Subject: The AST tree modification.
Hi everybody!
It is necessary to implement a plug-in for GCC designed to collect the
information on types of translation unit, and generate static const
array of types rtti_ex _ on its base;
Â//////////////////////////////////////
enumÂclassÂtype_Â{
ÂÂÂchar_,Âuchar_,Âshort_,Âushort_,Âint_,Âuint_,Âlong_,Âulong_,
ÂÂÂint64_,Âuint64_,Âarray_,Âpointer_,Âdouble_,Âlong_double_,Âfloat_,
ÂÂÂclass_
};
structÂrtti_ex_Â{ // <<<<<<<<<<<<<<<<<<<<<<<<<
ÂÂÂconstÂchar*Âname;
ÂÂÂconstÂtype_Âtype;
ÂÂÂconstÂsize_tÂsize;
ÂÂÂconstÂsize_tÂalign;
ÂÂÂconstÂsize_tÂoffset;
};
// generated from plugin.
static const rtti_ex_ rtti_ex_array_[] = {
 Â{...},
 Â{...},
 Â{...}
};
/////////////////////////////////////
There aren't any problems with information collection from AST. There
is a complexity with AST modification:
1. How to declare a variable?
2. How to declare the typedef?
3. How to declare a structure?
4. How to declare an array of structures?
I suppose that there should be a function like: tree make_subtree
(const char* source); which result I could insert in the corresponding
node. But I haven't found it.
Please, give me some links on this subject. It is very desirable, if
you could give some links with examples.
Thanks.