summaryrefslogtreecommitdiff
path: root/gdb/gdbtypes.h
diff options
context:
space:
mode:
authorTom Tromey <tromey@adacore.com>2020-04-24 13:40:31 -0600
committerTom Tromey <tromey@adacore.com>2020-04-24 13:40:32 -0600
commit9c6a1327ad9a92b8584f0501dd25bf8ba9e84ac6 (patch)
tree14dec82099b255fd009a7400d2cbbe0c34ab1e80 /gdb/gdbtypes.h
parentb249d2c2c01775fb015b38b272389b8693e414f6 (diff)
downloadbinutils-gdb-9c6a1327ad9a92b8584f0501dd25bf8ba9e84ac6.tar.gz
Rewrite the existing variant part code
This rewrites the existing variant part code to follow the new model implemented in the previous patch. The old variant part code is removed. This only affects Rust for the moment. I tested this using various version of the Rust compiler, including one that emits old-style enum debuginfo, exercising the quirks code. gdb/ChangeLog 2020-04-24 Tom Tromey <tromey@adacore.com> * dwarf2/read.c (struct variant_field): Rewrite. (struct variant_part_builder): New. (struct nextfield): Remove "variant" field. Add "offset". (struct field_info): Add "current_variant_part" and "variant_parts". (alloc_discriminant_info): Remove. (alloc_rust_variant): New function. (quirk_rust_enum): Update. (dwarf2_add_field): Set "offset" member. Don't handle DW_TAG_variant_part. (offset_map_type): New typedef. (convert_variant_range, create_one_variant) (create_one_variant_part, create_variant_parts) (add_variant_property): New functions. (dwarf2_attach_fields_to_type): Call add_variant_property. (read_structure_type): Don't handle DW_TAG_variant_part. (handle_variant_part, handle_variant): New functions. (handle_struct_member_die): Use them. (process_structure_scope): Don't handle variant parts. * gdbtypes.h (TYPE_FLAG_DISCRIMINATED_UNION): Remove. (struct discriminant_info): Remove. (enum dynamic_prop_node_kind) <DYN_PROP_DISCRIMINATED>: Remove. (struct main_type) <flag_discriminated_union>: Remove. * rust-lang.c (rust_enum_p, rust_empty_enum_p): Rewrite. (rust_enum_variant): Return int. Remove "contents". Rewrite. (rust_print_enum, rust_print_struct_def, rust_evaluate_subexp): Update. * valops.c (value_union_variant): Remove. * value.h (value_union_variant): Don't declare.
Diffstat (limited to 'gdb/gdbtypes.h')
-rw-r--r--gdb/gdbtypes.h51
1 files changed, 0 insertions, 51 deletions
diff --git a/gdb/gdbtypes.h b/gdb/gdbtypes.h
index f686e5407ba..134515845f2 100644
--- a/gdb/gdbtypes.h
+++ b/gdb/gdbtypes.h
@@ -319,14 +319,6 @@ DEF_ENUM_FLAGS_TYPE (enum type_instance_flag_value, type_instance_flags);
#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. */
@@ -482,39 +474,6 @@ struct variant_part : allocate_on_obstack
};
-/* * 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. */
@@ -591,9 +550,6 @@ enum dynamic_prop_node_kind
/* A property providing an array's byte stride. */
DYN_PROP_BYTE_STRIDE,
- /* A property holding information about a discriminated union. */
- DYN_PROP_DISCRIMINATED,
-
/* A property holding variant parts. */
DYN_PROP_VARIANT_PARTS,
};
@@ -831,13 +787,6 @@ struct main_type
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. */