In C++, an array type is not qualified; rather the type of the array
elements is qualified. This situation is reflected in the intermediate
representation. The macros described here will always examine the
qualification of the underlying element type when applied to an array
type. (If the element type is itself an array, then the recursion
continues until a non-array type is found, and the qualification of this
type is examined.) So, for example,
CP_TYPE_CONST_P will hold of
const int (), denoting an array of seven
The following functions and macros deal with cv-qualification of types:
TYPE_UNQUALIFIEDif no qualifiers have been applied. The
TYPE_QUAL_CONSTbit is set if the type is
TYPE_QUAL_VOLATILEbit is set if the type is
TYPE_QUAL_RESTRICTbit is set if the type is
const-qualified, but not
volatile-qualified; other cv-qualifiers are ignored as well: only the
const-ness is tested.
A few other macros and functions are usable with all types:
INTEGER_CST. For an incomplete type,
TYPE_DECL) for the type. (Note this macro does not return an
IDENTIFIER_NODE, as you might expect, given its name!) You can look at the
TYPE_DECLto obtain the actual name of the type. The
NULL_TREEfor a type that is not a built-in type, the result of a typedef, or a named class type.
void *. You may use
TYPE_PTROBV_Pto test for a pointer to object type as well as
The table below describes types specific to C and C++ as well as language-dependent info about GENERIC types.
TREE_TYPEis a pointer to data member type, then
TYPE_PTRMEM_Pwill hold. For a pointer to data member type of the form `T X::*',
TYPE_PTRMEM_CLASS_TYPEwill be the type
TYPE_PTRMEM_POINTED_TO_TYPEwill be the type
classtypes in C and C++. If
TYPE_PTRMEMFUNC_Pholds, then this type is a pointer-to-member type. In that case, the
POINTER_TYPEpointing to a
METHOD_TYPEis the type of a function pointed to by the pointer-to-member function. If
TYPE_PTRMEMFUNC_Pdoes not hold, this type is a class type. For more information, see see Classes.
typename T::A. The
A. If the type is specified via a template-id, then
NULLif the node is implicitly generated in support for the implicit typename extension; in which case the
TREE_TYPEis a type node for the base-class.
TYPE_FIELDSis the expression the type of which is being represented.