This is the mail archive of the
gcc-help@gcc.gnu.org
mailing list for the GCC project.
Re: TYPE_DECL nodes and what type they represent
- From: Ian Lance Taylor <iant at google dot com>
- To: David Philippi <philippi at absint dot com>
- Cc: gcc-help at gcc dot gnu dot org
- Date: Fri, 24 Apr 2009 12:42:03 -0700
- Subject: Re: TYPE_DECL nodes and what type they represent
- References: <200904241737.05485.philippi@absint.com>
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