This is the mail archive of the gcc@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

How to get C++ type from tree


Hi, this is my first mail to this list,
I am currently trying to write a tool that uses g++/gcc internal
representation to have a view of what classes are defined in the source
file being parsed.

I've looked at gccxml which dumps data from source file, but as i've seen
it cannot output the class declared in the source file, if it is not used
at toplevel.

something like:
---
class Test
{
  int foo;
};
----

give no output for gccxml.

I currently use gcc source from the cvs.
My code get invoked in the semantic.c file (like in the gccxml)
right after:     (*lang_hooks.finish_file) ();
in the finish_translation_unit () function.

And then i use the global_namespace tree, and go over the tree to find
what the different node are (only the fist level).
By doing this i cannot get the RECORD_TYPE tree node associated with the
class (as i have found it should be in the gccint manual).

Could someone give me a hint, on how to get the data for the different
declared code ?

perhaps i am wrong by using the global_namespace tree for my entry point?
Or i have missed something important about the class
definition/declaration in the manual.









Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]