This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
GCC tree access
- From: "Jeffrey Richardson" <jlrichardson at link dot com>
- To: gcc at gcc dot gnu dot org
- Date: Tue, 12 Nov 2002 08:39:39 -0500
- Subject: GCC tree access
- Organization: L 3 Communications
Hello,
I am interested in developing a combination "intelligent editor" and
source browser using the tree structure created internally by GCC, as
described in the article on trees in the GCC Internals manual.
I see the example "process_stmt" function in the article on Function
Bodies. I also see the function "expand_stmt" in the file c-semantics.c
which is called by a number of functions including several genrtl_
functions, and the c_expand_body function. The c_expand_body function
is in turn called from several places including finish_function in
c-decl.c.
My question is this: if I write my own version of "precess_stmt" which
uses the macros to access various tree information and write it out to a
file, where is the best place to call my function? Can it be called
from a single location (such as finish_function), and still have access
to the full tree structure?
Also, what is the "permanence" of the tree structure. As a source file
is parsed, and the tree structure is constructed, is there a point at
which branches of the tree are discarded because they are no longer
needed (e.g. when a function has been completed), or is there a point at
which a complete tree exists for the entire source file, which would
therefore be the best time to call a function to output a "snapshot" of
the tree? (I guess this is actually a re-statement of my first
question.)
If there are any examples or code fragments of similar applications that
you can share with me, I would very much appreciate it. I am primarily
interest in processing C source code right now, but would like to make
the application robust enough to handle C++ as well, and take advantage
of the fact that they are both parsed into a tree.
Thankyou,
Jeff Richardson
jlrichardson@link.com
(407)382-1580
begin:vcard
n:Richardson;Jeff
tel;fax:(407)249-8413
tel;work:(407)382-1580
x-mozilla-html:FALSE
adr:;;;;;;
version:2.1
email;internet:jlrichardson@link.com
fn:Jeff Richardson
end:vcard