gdb: add type::target_type / type::set_target_type

Add the `target_type` and `set_target_type` methods on `struct type`, in order
to remove the `TYPE_TARGET_TYPE` macro.  In this patch, the macro is changed to
use the getter, so all the call sites of the macro that are used as a setter
are changed to use the setter method directly.  The next patch will remove the
macro completely.

Change-Id: I85ce24d847763badd34fdee3e14b8c8c14cb3161
This commit is contained in:
Simon Marchi 2022-07-30 12:07:39 -04:00
parent 0242db993f
commit 8a50fdcefc
10 changed files with 70 additions and 61 deletions

View file

@ -8114,7 +8114,7 @@ template_to_static_fixed_type (struct type *type0)
/* Whether or not we cloned TYPE0, cache the result so that we don't do
recompute all over next time. */
TYPE_TARGET_TYPE (type0) = type;
type0->set_target_type (type);
for (f = 0; f < nfields; f += 1)
{
@ -8134,7 +8134,8 @@ template_to_static_fixed_type (struct type *type0)
/* Clone TYPE0 only the first time we get a new field type. */
if (type == type0)
{
TYPE_TARGET_TYPE (type0) = type = alloc_type_copy (type0);
type = alloc_type_copy (type0);
type0->set_target_type (type);
type->set_code (type0->code ());
INIT_NONE_SPECIFIC (type);
type->set_num_fields (nfields);
@ -10278,8 +10279,8 @@ ada_ternop_slice (struct expression *exp,
the aligners. */
if (value_type (array)->code () == TYPE_CODE_REF
&& ada_is_aligner_type (TYPE_TARGET_TYPE (value_type (array))))
TYPE_TARGET_TYPE (value_type (array)) =
ada_aligned_type (TYPE_TARGET_TYPE (value_type (array)));
value_type (array)->set_target_type
(ada_aligned_type (TYPE_TARGET_TYPE (value_type (array))));
if (ada_is_any_packed_array_type (value_type (array)))
error (_("cannot slice a packed array"));