diff options
author | Simon Marchi <simon.marchi@efficios.com> | 2020-06-08 15:26:04 -0400 |
---|---|---|
committer | Simon Marchi <simon.marchi@efficios.com> | 2020-06-08 15:26:04 -0400 |
commit | 5d14b6e5d6525ce462c30501644922a10f8682eb (patch) | |
tree | 0f1ce729b9393dc161bbcc4fc70f5b7b0a3ff335 /gdb/ada-lang.c | |
parent | 3d967001ecd3b325fc39d7f53ebf7054d1ecd503 (diff) | |
download | binutils-5d14b6e5d6525ce462c30501644922a10f8682eb.zip binutils-5d14b6e5d6525ce462c30501644922a10f8682eb.tar.gz binutils-5d14b6e5d6525ce462c30501644922a10f8682eb.tar.bz2 |
gdb: add field::type / field::set_type
Add the `type` and `set_type` methods on `struct field`, in order to
remoremove the `FIELD_TYPE` macro. In this patch, the `FIELD_TYPE`
macro is changed to use `field::type`, so all the call sites that are
useused to set the field's type are changed to use `field::set_type`.
The next patch will remove `FIELD_TYPE` completely.
Note that because of the name clash between the existing field named
`type` and the new method, I renamed the field `m_type`. It is not
private per-se, because we can't make `struct field` a non-POD yet, but
it should be considered private anyway (not accessed outside `struct
field`).
gdb/ChangeLog:
* gdbtypes.h (struct field) <type, set_type>: New methods.
Rename `type` field to...
<m_type>: ... this. Change references throughout to use type or
set_type methods.
(FIELD_TYPE): Use field::type. Change call sites that modify
the field's type to use field::set_type instead.
Change-Id: Ie21f866e3b7f8a51ea49b722d07d272a724459a0
Diffstat (limited to 'gdb/ada-lang.c')
-rw-r--r-- | gdb/ada-lang.c | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/gdb/ada-lang.c b/gdb/ada-lang.c index 4f6c6b4..20c27c4 100644 --- a/gdb/ada-lang.c +++ b/gdb/ada-lang.c @@ -1432,7 +1432,7 @@ ada_fixup_array_indexes_type (struct type *index_desc_type) struct type *raw_type = ada_check_typedef (ada_find_any_type (name)); if (raw_type) - TYPE_FIELD_TYPE (index_desc_type, i) = raw_type; + index_desc_type->field (i).set_type (raw_type); } } @@ -8088,7 +8088,7 @@ ada_template_to_fixed_record_type_1 (struct type *type, record size. */ ada_ensure_varsize_limit (field_type); - TYPE_FIELD_TYPE (rtype, f) = field_type; + rtype->field (f).set_type (field_type); TYPE_FIELD_NAME (rtype, f) = TYPE_FIELD_NAME (type, f); /* The multiplication can potentially overflow. But because the field length has been size-checked just above, and @@ -8111,7 +8111,7 @@ ada_template_to_fixed_record_type_1 (struct type *type, structure, the typedef is the only clue which allows us to distinguish between the two options. Stripping it would prevent us from printing this field appropriately. */ - TYPE_FIELD_TYPE (rtype, f) = TYPE_FIELD_TYPE (type, f); + rtype->field (f).set_type (TYPE_FIELD_TYPE (type, f)); TYPE_FIELD_NAME (rtype, f) = TYPE_FIELD_NAME (type, f); if (TYPE_FIELD_BITSIZE (type, f) > 0) fld_bit_len = @@ -8173,7 +8173,7 @@ ada_template_to_fixed_record_type_1 (struct type *type, } else { - TYPE_FIELD_TYPE (rtype, variant_field) = branch_type; + rtype->field (variant_field).set_type (branch_type); TYPE_FIELD_NAME (rtype, variant_field) = "S"; fld_bit_len = TYPE_LENGTH (TYPE_FIELD_TYPE (rtype, variant_field)) * @@ -8289,7 +8289,7 @@ template_to_static_fixed_type (struct type *type0) TYPE_FIXED_INSTANCE (type) = 1; TYPE_LENGTH (type) = 0; } - TYPE_FIELD_TYPE (type, f) = new_type; + type->field (f).set_type (new_type); TYPE_FIELD_NAME (type, f) = TYPE_FIELD_NAME (type0, f); } } @@ -8358,7 +8358,7 @@ to_record_with_fixed_variant_part (struct type *type, const gdb_byte *valaddr, } else { - TYPE_FIELD_TYPE (rtype, variant_field) = branch_type; + rtype->field (variant_field).set_type (branch_type); TYPE_FIELD_NAME (rtype, variant_field) = "S"; TYPE_FIELD_BITSIZE (rtype, variant_field) = 0; TYPE_LENGTH (rtype) += TYPE_LENGTH (branch_type); |