#define TYPE_FLAG_ENUM(t) (TYPE_MAIN_TYPE (t)->flag_flag_enum)
+/* * True if this type is a discriminated union type. Only valid for
+ TYPE_CODE_UNION. A discriminated union stores a reference to the
+ discriminant field along with the discriminator values in a dynamic
+ property. */
+
+#define TYPE_FLAG_DISCRIMINATED_UNION(t) \
+ (TYPE_MAIN_TYPE (t)->flag_discriminated_union)
+
/* * Constant type. If this is set, the corresponding type has a
const modifier. */
#define TYPE_ADDRESS_CLASS_ALL(t) (TYPE_INSTANCE_FLAGS(t) \
& TYPE_INSTANCE_FLAG_ADDRESS_CLASS_ALL)
+/* * Information needed for a discriminated union. A discriminated
+ union is handled somewhat differently from an ordinary union.
+
+ One field is designated as the discriminant. Only one other field
+ is active at a time; which one depends on the value of the
+ discriminant and the data in this structure.
+
+ Additionally, it is possible to have a univariant discriminated
+ union. In this case, the union has just a single field, which is
+ assumed to be the only active variant -- in this case no
+ discriminant is provided. */
+
+struct discriminant_info
+{
+ /* * The index of the discriminant field. If -1, then this union
+ must have just a single field. */
+
+ int discriminant_index;
+
+ /* * The index of the default branch of the union. If -1, then
+ there is no default branch. */
+
+ int default_index;
+
+ /* * The discriminant values corresponding to each branch. This has
+ a number of entries equal to the number of fields in this union.
+ If discriminant_index is not -1, then that entry in this array is
+ not used. If default_index is not -1, then that entry in this
+ array is not used. */
+
+ ULONGEST discriminants[1];
+};
+
enum dynamic_prop_kind
{
PROP_UNDEFINED, /* Not defined. */
/* A property providing an array's byte stride. */
DYN_PROP_BYTE_STRIDE,
+
+ /* A property holding information about a discriminated union. */
+ DYN_PROP_DISCRIMINATED,
};
/* * List for dynamic type attributes. */
unsigned int flag_flag_enum : 1;
+ /* * True if this type is a discriminated union type. Only valid
+ for TYPE_CODE_UNION. A discriminated union stores a reference to
+ the discriminant field along with the discriminator values in a
+ dynamic property. */
+
+ unsigned int flag_discriminated_union : 1;
+
/* * A discriminant telling us which field of the type_specific
union is being used for this type, if any. */
struct dynamic_prop_list *dyn_prop_list;
};
+/* * Number of bits allocated for alignment. */
+
+#define TYPE_ALIGN_BITS 8
+
/* * A ``struct type'' describes a particular instance of a type, with
some particular qualification. */
struct type *chain;
+ /* * The alignment for this type. Zero means that the alignment was
+ not specified in the debug info. Note that this is stored in a
+ funny way: as the log base 2 (plus 1) of the alignment; so a
+ value of 1 means the alignment is 1, and a value of 9 means the
+ alignment is 256. */
+
+ unsigned align_log2 : TYPE_ALIGN_BITS;
+
/* * Flags specific to this instance of the type, indicating where
on the ring we are.
instance flags are completely inherited from the target type. No
qualifiers can be cleared by the typedef. See also
check_typedef. */
- int instance_flags;
+ unsigned instance_flags : 9;
/* * Length of storage for a value of this type. The value is the
expression in host bytes of what sizeof(type) would return. This
so you only have to call check_typedef once. Since allocate_value
calls check_typedef, TYPE_LENGTH (VALUE_TYPE (X)) is safe. */
#define TYPE_LENGTH(thistype) (thistype)->length
+
+/* * Return the alignment of the type in target addressable memory
+ units, or 0 if no alignment was specified. */
+#define TYPE_RAW_ALIGN(thistype) type_raw_align (thistype)
+
+/* * Return the alignment of the type in target addressable memory
+ units, or 0 if no alignment was specified. */
+extern unsigned type_raw_align (struct type *);
+
+/* * Return the alignment of the type in target addressable memory
+ units. Return 0 if the alignment cannot be determined; but note
+ that this makes an effort to compute the alignment even it it was
+ not specified in the debug info. */
+extern unsigned type_align (struct type *);
+
+/* * Set the alignment of the type. The alignment must be a power of
+ 2. Returns false if the given value does not fit in the available
+ space in struct type. */
+extern bool set_type_align (struct type *, ULONGEST);
+
/* * Note that TYPE_CODE can be TYPE_CODE_TYPEDEF, so if you want the real
type, you need to do TYPE_CODE (check_type (this_type)). */
#define TYPE_CODE(thistype) TYPE_MAIN_TYPE(thistype)->code