gccint: Types for C++
1
1 11.10.1 Types for C++
1 ---------------------
1
1 In C++, an array type is not qualified; rather the type of the array
1 elements is qualified. This situation is reflected in the intermediate
1 representation. The macros described here will always examine the
1 qualification of the underlying element type when applied to an array
1 type. (If the element type is itself an array, then the recursion
1 continues until a non-array type is found, and the qualification of this
1 type is examined.) So, for example, 'CP_TYPE_CONST_P' will hold of the
1 type 'const int ()[7]', denoting an array of seven 'int's.
1
1 The following functions and macros deal with cv-qualification of types:
1 'cp_type_quals'
1 This function returns the set of type qualifiers applied to this
1 type. This value is 'TYPE_UNQUALIFIED' if no qualifiers have been
1 applied. The 'TYPE_QUAL_CONST' bit is set if the type is
1 'const'-qualified. The 'TYPE_QUAL_VOLATILE' bit is set if the type
1 is 'volatile'-qualified. The 'TYPE_QUAL_RESTRICT' bit is set if
1 the type is 'restrict'-qualified.
1
1 'CP_TYPE_CONST_P'
1 This macro holds if the type is 'const'-qualified.
1
1 'CP_TYPE_VOLATILE_P'
1 This macro holds if the type is 'volatile'-qualified.
1
1 'CP_TYPE_RESTRICT_P'
1 This macro holds if the type is 'restrict'-qualified.
1
1 'CP_TYPE_CONST_NON_VOLATILE_P'
1 This predicate holds for a type that is 'const'-qualified, but
1 _not_ 'volatile'-qualified; other cv-qualifiers are ignored as
1 well: only the 'const'-ness is tested.
1
1 A few other macros and functions are usable with all types:
1 'TYPE_SIZE'
1 The number of bits required to represent the type, represented as
1 an 'INTEGER_CST'. For an incomplete type, 'TYPE_SIZE' will be
1 'NULL_TREE'.
1
1 'TYPE_ALIGN'
1 The alignment of the type, in bits, represented as an 'int'.
1
1 'TYPE_NAME'
1 This macro returns a declaration (in the form of a 'TYPE_DECL') for
1 the type. (Note this macro does _not_ return an 'IDENTIFIER_NODE',
1 as you might expect, given its name!) You can look at the
1 'DECL_NAME' of the 'TYPE_DECL' to obtain the actual name of the
1 type. The 'TYPE_NAME' will be 'NULL_TREE' for a type that is not a
1 built-in type, the result of a typedef, or a named class type.
1
1 'CP_INTEGRAL_TYPE'
1 This predicate holds if the type is an integral type. Notice that
1 in C++, enumerations are _not_ integral types.
1
1 'ARITHMETIC_TYPE_P'
1 This predicate holds if the type is an integral type (in the C++
1 sense) or a floating point type.
1
1 'CLASS_TYPE_P'
1 This predicate holds for a class-type.
1
1 'TYPE_BUILT_IN'
1 This predicate holds for a built-in type.
1
1 'TYPE_PTRDATAMEM_P'
1 This predicate holds if the type is a pointer to data member.
1
1 'TYPE_PTR_P'
1 This predicate holds if the type is a pointer type, and the pointee
1 is not a data member.
1
1 'TYPE_PTRFN_P'
1 This predicate holds for a pointer to function type.
1
1 'TYPE_PTROB_P'
1 This predicate holds for a pointer to object type. Note however
1 that it does not hold for the generic pointer to object type 'void
1 *'. You may use 'TYPE_PTROBV_P' to test for a pointer to object
1 type as well as 'void *'.
1
1 The table below describes types specific to C and C++ as well as
1 language-dependent info about GENERIC types.
1
1 'POINTER_TYPE'
1 Used to represent pointer types, and pointer to data member types.
1 If 'TREE_TYPE' is a pointer to data member type, then
1 'TYPE_PTRDATAMEM_P' will hold. For a pointer to data member type
1 of the form 'T X::*', 'TYPE_PTRMEM_CLASS_TYPE' will be the type
1 'X', while 'TYPE_PTRMEM_POINTED_TO_TYPE' will be the type 'T'.
1
1 'RECORD_TYPE'
1 Used to represent 'struct' and 'class' types in C and C++. If
1 'TYPE_PTRMEMFUNC_P' holds, then this type is a pointer-to-member
1 type. In that case, the 'TYPE_PTRMEMFUNC_FN_TYPE' is a
1 'POINTER_TYPE' pointing to a 'METHOD_TYPE'. The 'METHOD_TYPE' is
1 the type of a function pointed to by the pointer-to-member
1 function. If 'TYPE_PTRMEMFUNC_P' does not hold, this type is a
1 class type. For more information, ⇒Classes.
1
1 'UNKNOWN_TYPE'
1 This node is used to represent a type the knowledge of which is
1 insufficient for a sound processing.
1
1 'TYPENAME_TYPE'
1 Used to represent a construct of the form 'typename T::A'. The
1 'TYPE_CONTEXT' is 'T'; the 'TYPE_NAME' is an 'IDENTIFIER_NODE' for
1 'A'. If the type is specified via a template-id, then
1 'TYPENAME_TYPE_FULLNAME' yields a 'TEMPLATE_ID_EXPR'. The
1 'TREE_TYPE' is non-'NULL' if the node is implicitly generated in
1 support for the implicit typename extension; in which case the
1 'TREE_TYPE' is a type node for the base-class.
1
1 'TYPEOF_TYPE'
1 Used to represent the '__typeof__' extension. The 'TYPE_FIELDS' is
1 the expression the type of which is being represented.
1