+/* * 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. */
+ PROP_CONST, /* Constant. */
+ PROP_ADDR_OFFSET, /* Address offset. */
+ PROP_LOCEXPR, /* Location expression. */
+ PROP_LOCLIST /* Location list. */
+};
+
+union dynamic_prop_data
+{
+ /* Storage for constant property. */
+
+ LONGEST const_val;
+
+ /* Storage for dynamic property. */
+
+ void *baton;
+};
+
+/* * Used to store a dynamic property. */
+
+struct dynamic_prop
+{
+ /* Determine which field of the union dynamic_prop.data is used. */
+ enum dynamic_prop_kind kind;
+
+ /* Storage for dynamic or static value. */
+ union dynamic_prop_data data;
+};
+
+/* Compare two dynamic_prop objects for equality. dynamic_prop
+ instances are equal iff they have the same type and storage. */
+extern bool operator== (const dynamic_prop &l, const dynamic_prop &r);
+
+/* Compare two dynamic_prop objects for inequality. */
+static inline bool operator!= (const dynamic_prop &l, const dynamic_prop &r)
+{
+ return !(l == r);
+}
+
+/* * Define a type's dynamic property node kind. */
+enum dynamic_prop_node_kind
+{
+ /* A property providing a type's data location.
+ Evaluating this field yields to the location of an object's data. */
+ DYN_PROP_DATA_LOCATION,
+
+ /* A property representing DW_AT_allocated. The presence of this attribute
+ indicates that the object of the type can be allocated/deallocated. */
+ DYN_PROP_ALLOCATED,
+
+ /* A property representing DW_AT_allocated. The presence of this attribute
+ indicated that the object of the type can be associated. */
+ DYN_PROP_ASSOCIATED,
+
+ /* 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. */
+struct dynamic_prop_list
+{
+ /* The kind of dynamic prop in this node. */
+ enum dynamic_prop_node_kind prop_kind;
+
+ /* The dynamic property itself. */
+ struct dynamic_prop prop;
+
+ /* A pointer to the next dynamic property. */
+ struct dynamic_prop_list *next;
+};
+
+/* * Determine which field of the union main_type.fields[x].loc is
+ used. */