diff options
author | Simon Marchi <simon.marchi@polymtl.ca> | 2022-07-30 12:01:12 -0400 |
---|---|---|
committer | Simon Marchi <simon.marchi@polymtl.ca> | 2022-09-21 10:59:51 -0400 |
commit | b6cdbc9a8173b9e6cc8cfc284caa0efa8129ca02 (patch) | |
tree | 4b7956463a020307fcfa270fdb15f744adcf5c18 /gdb/coffread.c | |
parent | 27710edb4e588d0360620df424dd7ee7e8cfafee (diff) | |
download | fsf-binutils-gdb-b6cdbc9a8173b9e6cc8cfc284caa0efa8129ca02.zip fsf-binutils-gdb-b6cdbc9a8173b9e6cc8cfc284caa0efa8129ca02.tar.gz fsf-binutils-gdb-b6cdbc9a8173b9e6cc8cfc284caa0efa8129ca02.tar.bz2 |
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
Diffstat (limited to 'gdb/coffread.c')
-rw-r--r-- | gdb/coffread.c | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/gdb/coffread.c b/gdb/coffread.c index 27afa11..8019789 100644 --- a/gdb/coffread.c +++ b/gdb/coffread.c @@ -1472,7 +1472,7 @@ patch_type (struct type *type, struct type *real_type) struct type *real_target = real_type->target_type (); int field_size = real_target->num_fields () * sizeof (struct field); - TYPE_LENGTH (target) = TYPE_LENGTH (real_target); + target->set_length (real_target->length ()); target->set_num_fields (real_target->num_fields ()); field *fields = (struct field *) TYPE_ALLOC (target, field_size); @@ -1887,7 +1887,7 @@ decode_base_type (struct coff_symbol *cs, type->set_code (TYPE_CODE_STRUCT); type->set_name (NULL); INIT_CPLUS_SPECIFIC (type); - TYPE_LENGTH (type) = 0; + type->set_length (0); type->set_fields (nullptr); type->set_num_fields (0); } @@ -1907,7 +1907,7 @@ decode_base_type (struct coff_symbol *cs, type = coff_alloc_type (cs->c_symnum); type->set_name (NULL); INIT_CPLUS_SPECIFIC (type); - TYPE_LENGTH (type) = 0; + type->set_length (0); type->set_fields (nullptr); type->set_num_fields (0); } @@ -1928,7 +1928,7 @@ decode_base_type (struct coff_symbol *cs, type = coff_alloc_type (cs->c_symnum); type->set_code (TYPE_CODE_ENUM); type->set_name (NULL); - TYPE_LENGTH (type) = 0; + type->set_length (0); type->set_fields (nullptr); type->set_num_fields (0); } @@ -1996,7 +1996,7 @@ coff_read_struct_type (int index, int length, int lastsym, type = coff_alloc_type (index); type->set_code (TYPE_CODE_STRUCT); INIT_CPLUS_SPECIFIC (type); - TYPE_LENGTH (type) = length; + type->set_length (length); while (!done && symnum < lastsym && symnum < nlist_nsyms_global) { @@ -2124,9 +2124,9 @@ coff_read_enum_type (int index, int length, int lastsym, /* Now fill in the fields of the type-structure. */ if (length > 0) - TYPE_LENGTH (type) = length; + type->set_length (length); else /* Assume ints. */ - TYPE_LENGTH (type) = gdbarch_int_bit (gdbarch) / TARGET_CHAR_BIT; + type->set_length (gdbarch_int_bit (gdbarch) / TARGET_CHAR_BIT); type->set_code (TYPE_CODE_ENUM); type->set_num_fields (nsyms); type->set_fields |