[binutils-gdb] gdb: convert TYPE_ADDRESS_CLASS macro to type::address_class
Tankut Baris Aktemur via Gdb-cvs <[email protected]> Thu, 23 Jul 2026 10:13:45 +0000 (GMT)
| Newsgroups | gmane.comp.gdb.cvs |
|---|---|
| Message-ID | <[email protected]> |
https://sourceware.org/git/gitweb.cgi?p=3Dbinutils-gdb.git;h=3Dbac31f434f34= 692fbdb5cabfaf7f83740e0fad59 commit bac31f434f34692fbdb5cabfaf7f83740e0fad59 Author: Tankut Baris Aktemur <[email protected]> Date: Thu Jul 23 05:04:43 2026 -0500 gdb: convert TYPE_ADDRESS_CLASS macro to type::address_class =20 Convert the TYPE_ADDRESS_CLASS macro to a method of the type class. Th= is is a refactoring. =20 Approved-By: Tom Tromey <[email protected]> Diff: --- gdb/avr-tdep.c | 4 ++-- gdb/c-typeprint.c | 2 +- gdb/ft32-tdep.c | 2 +- gdb/gdbtypes.c | 8 +++----- gdb/gdbtypes.h | 9 ++++++--- 5 files changed, 13 insertions(+), 12 deletions(-) diff --git a/gdb/avr-tdep.c b/gdb/avr-tdep.c index 682b7e8586d..012022f2b73 100644 --- a/gdb/avr-tdep.c +++ b/gdb/avr-tdep.c @@ -305,7 +305,7 @@ avr_address_to_pointer (struct gdbarch *gdbarch, enum bfd_endian byte_order =3D gdbarch_byte_order (gdbarch); =20 /* Is it a data address in flash? */ - if (TYPE_ADDRESS_CLASS (type) =3D=3D AVR_ADDRESS_CLASS_FLASH) + if (type->address_class () =3D=3D AVR_ADDRESS_CLASS_FLASH) { /* A data pointer in flash is byte addressed. */ store_unsigned_integer (buf, type->length (), byte_order, @@ -337,7 +337,7 @@ avr_pointer_to_address (struct gdbarch *gdbarch, =3D extract_unsigned_integer (buf, type->length (), byte_order); =20 /* Is it a data address in flash? */ - if (TYPE_ADDRESS_CLASS (type) =3D=3D AVR_ADDRESS_CLASS_FLASH) + if (type->address_class () =3D=3D AVR_ADDRESS_CLASS_FLASH) { /* A data pointer in flash is already byte addressed. */ return avr_make_iaddr (addr); diff --git a/gdb/c-typeprint.c b/gdb/c-typeprint.c index 92938270647..07f01c92b15 100644 --- a/gdb/c-typeprint.c +++ b/gdb/c-typeprint.c @@ -492,7 +492,7 @@ c_type_print_modifier (struct type *type, struct ui_fil= e *stream, else if (gdbarch_address_class_id_to_name_p (type->arch ())) address_space_id =3D gdbarch_address_class_id_to_name (type->arch (), - TYPE_ADDRESS_CLASS (type)); + type->address_class ()); =20 if (address_space_id !=3D nullptr) { diff --git a/gdb/ft32-tdep.c b/gdb/ft32-tdep.c index f951a6f25e3..38b4784ed35 100644 --- a/gdb/ft32-tdep.c +++ b/gdb/ft32-tdep.c @@ -332,7 +332,7 @@ ft32_pointer_to_address (struct gdbarch *gdbarch, CORE_ADDR addr =3D extract_unsigned_integer (buf, type->length (), byte_order); =20 - if (TYPE_ADDRESS_CLASS (type) =3D=3D 1) + if (type->address_class () =3D=3D 1) return addr; else return addr | RAM_BIAS; diff --git a/gdb/gdbtypes.c b/gdb/gdbtypes.c index 34eaac42e20..f9764fb1da3 100644 --- a/gdb/gdbtypes.c +++ b/gdb/gdbtypes.c @@ -710,7 +710,7 @@ replace_type (struct type *ntype, struct type *type) variants. This assertion shouldn't ever be triggered because symbol readers which do construct address-class variants don't call replace_type(). */ - gdb_assert (TYPE_ADDRESS_CLASS (chain) =3D=3D 0); + gdb_assert (chain->address_class () =3D=3D 0); =20 chain->set_length (type->length ()); chain =3D chain->chain; @@ -5029,10 +5029,8 @@ recursive_dump_type (struct type *type, int spaces) gdb_puts (" TYPE_CODE_SPACE"); if (type->is_data_space ()) gdb_puts (" TYPE_DATA_SPACE"); - if (TYPE_ADDRESS_CLASS (type) !=3D 0) - { - gdb_printf (" TYPE_ADDRESS_CLASS(%u)", TYPE_ADDRESS_CLASS (type)); - } + if (type->address_class () !=3D 0) + gdb_printf (" TYPE_ADDRESS_CLASS(%u)", type->address_class ()); if (type->is_restrict ()) gdb_puts (" TYPE_RESTRICT"); if (type->is_atomic ()) diff --git a/gdb/gdbtypes.h b/gdb/gdbtypes.h index 624d468e4f2..ecd71f96497 100644 --- a/gdb/gdbtypes.h +++ b/gdb/gdbtypes.h @@ -186,9 +186,6 @@ struct type_instance_flags (((t)->dyn_prop (DYN_PROP_BYTE_SIZE) !=3D nullptr) \ || ((t)->dyn_prop (DYN_PROP_BIT_SIZE) !=3D nullptr)) =20 -#define TYPE_ADDRESS_CLASS(t) \ - (((t)->instance_flags ()).address_class) - /* Information about a single discriminant. */ =20 struct discriminant_range @@ -1231,6 +1228,12 @@ struct type return this->m_instance_flags.is_atomic; } =20 + /* Return the address class of this type. */ + unsigned int address_class () const + { + return this->m_instance_flags.address_class; + } + /* Get the bounds bounds of this type. The type must be a range type. = */ range_bounds *bounds () const {