using GCC internal TREE representation.

Sri Sairam Goli goli@optonline.net
Thu Dec 6 06:07:00 GMT 2001


Hi,

In one  of my project I need a tool that parses a c++ file and generates

output which contains all the struct declarations encounetered in the
original c++ file.  If struct contains another struct it needs to be
expanded
there.

Say for example if a have a code like this embedded insode any c++
code.

strcu A {
   int x;
   int y;
};

struct B {
   struct A a;
   int z;
};

I need an output like this for the second struct

struct B {
    struct A {
           int x;
            int y;
     } a;
     int z;
};


I am planning to use the gcc to parse my initial file and later walk
through the
internal TREE to dump the output as I need.

I looked at the GCC  manual (TREEs usage), but I am not quite sure how
can I
get access to the internal TREE from my own program any pointers in this
regard
will be appreciated.

(If there is any better way of doing the same thing instead of using the
gcc TREEs
 please suggest me).

Thanks,
goli





More information about the Gcc mailing list