This is the mail archive of the 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]

[Fwd: GCC tree access]

Jeff Richardson wrote:

> 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
> (407)382-1580

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