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 extract internal tree structure information?


Hi,

I'm trying to extract information from C++ code during the compilation process.
I need information about declarations, statements, functions (including
parameters and symbol name), source line and source file.

In my opinion I have two ways to solve this problem:

1) The first one is to find the place where parser and semantic analyser create
the necessary information and to write the data e.g in a file. But for me this
is the worst case, because I have to change the gcc code at numerous positions.

2) The second and (in my opinion) more elegant way would be to extract the
desired information from the tree structure after lexing, parsing and semantic
analyis. I want to add one function to the gcc code and do the rest of this job
outside (like GCC-XML). But, therefor I need at first a position in the gcc code
where I can add my function (at the moment I use finish_translation_unit) and
secondly I need a tree structure (cp_global_trees, global_trees or something
else) which holds the whole translation unit with all necessary information. I
had some tests with global_namespace, but there I naturally miss my classes.

Could somebody please point out good places for me to add such a function?
Could you please name tree structures which contain the full information?

Any hint greatly appreachiated,
Christian





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