Hello Boris,

Boris Kolpackov <bo...@codesynthesis.com> a écrit:

> I am trying to figure out how to get a typedef hierarchy from the C/C++
> tree in GCC. Consider the following declarations:
>
> struct s {};
>
> typedef s s_t;
> typedef s_t my_s_t;
>
> my_s_t x;
>
> Giveb 'x' VAR_DECL I can have this traversal using TYPE_MAIN_VARIANT():
>
> x -> my_s_t -> s;
>
> What I am trying to achieve is this:
>
> x -> my_s_t -> s_t -> s

In G++, let's say that the tree node representing my_s_t is t.  Then,
DECL_ORIGINAL_TYPE (TYPE_NAME (t)) points to the tree node of s_t.  You
can walk the relationship "t is a typedef of foo" like that.  For the C
front-end though, I am not sure.

-- 
                Dodji

Reply via email to