TYPE_DECL nodes and what type they represent

Ian Lance Taylor iant@google.com
Fri Apr 24 19:42:00 GMT 2009


David Philippi <philippi@absint.com> writes:

> I'm somewhat at a loss with getting the type information out of TYPE_DECL 
> nodes. From the comments in the code it seems like I should be able to 
> identify not only the typedef name but also the original builtin / compound 
> type which is the base for the typedef.
> I've found the DECL_ORIGINAL_TYPE macro but I've not been able to get the type 
> from its return value so far. Any pointers to documentation or code with nice 
> comments about this would be welcome. The tree documentation in the wiki is 
> nice but I couldn't find the required information there.

The documentation is minimal, but see also
http://gcc.gnu.org/onlinedocs/gccint/Types.html

A typedef statement will normally create a TYPE_DECL node.  For a
TYPE_DECL x, DECL_NAME(x) is the name of the typedef, and TREE_TYPE(x)
is the type.  DECL_ORIGINAL_TYPE exists mainly for debugging
information.

Ian



More information about the Gcc-help mailing list