gdb: add type::length / type::set_length

Add the `length` and `set_length` methods on `struct type`, in order to remove
the `TYPE_LENGTH` 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: Id1090244f15c9856969b9be5006aefe8d8897ca4
This commit is contained in:
Simon Marchi
2022-07-30 12:01:12 -04:00
parent 27710edb4e
commit b6cdbc9a81
14 changed files with 119 additions and 116 deletions

View File

@ -1022,7 +1022,7 @@ parse_symbol (SYMR *sh, union aux_ext *ax, char *ext_sh, int bigend,
name, (char *) NULL));
t->set_code (type_code);
TYPE_LENGTH (t) = sh->value;
t->set_length (sh->value);
t->set_num_fields (nfields);
f = ((struct field *) TYPE_ALLOC (t, nfields * sizeof (struct field)));
t->set_fields (f);
@ -1043,7 +1043,7 @@ parse_symbol (SYMR *sh, union aux_ext *ax, char *ext_sh, int bigend,
that too. */
if (TYPE_LENGTH (t) == t->num_fields ()
|| TYPE_LENGTH (t) == 0)
TYPE_LENGTH (t) = gdbarch_int_bit (gdbarch) / HOST_CHAR_BIT;
t->set_length (gdbarch_int_bit (gdbarch) / HOST_CHAR_BIT);
for (ext_tsym = ext_sh + external_sym_size;
;
ext_tsym += external_sym_size)