[binutils-gdb] gdb: remove TYPE_REFERENCE_TYPE

Simon Marchi via Gdb-cvs <[email protected]>
Newsgroups gmane.comp.gdb.cvs
Message-ID <[email protected]>
https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=3e51c419683558e6adbe137be5104da92bebc1e0

commit 3e51c419683558e6adbe137be5104da92bebc1e0
Author: Simon Marchi <[email protected]>
Date:   Mon Mar 16 10:25:21 2026 -0400

    gdb: remove TYPE_REFERENCE_TYPE
    
    IMO, there is no point in keeping this macro.  Remove it and access the
    field directly.  If we ever want some kind of abstraction in front of
    the field, then we'll add a method.
    
    Change-Id: Iabdb3a3eecd8274ddefc32ad835644bc4a0d2087
    Approved-By: Andrew Burgess <[email protected]>

Diff:
---
 gdb/gdbtypes.c | 8 ++++----
 gdb/gdbtypes.h | 1 -
 2 files changed, 4 insertions(+), 5 deletions(-)

diff --git a/gdb/gdbtypes.c b/gdb/gdbtypes.c
index 8ebe9948bd2..425aacc4a82 100644
--- a/gdb/gdbtypes.c
+++ b/gdb/gdbtypes.c
@@ -418,7 +418,7 @@ make_reference_type (type *type, type_code refcode)
 
   gdb_assert (refcode == TYPE_CODE_REF || refcode == TYPE_CODE_RVALUE_REF);
 
-  ntype = (refcode == TYPE_CODE_REF ? TYPE_REFERENCE_TYPE (type)
+  ntype = (refcode == TYPE_CODE_REF ? type->reference_type
 	   : TYPE_RVALUE_REFERENCE_TYPE (type));
 
   if (ntype)
@@ -426,7 +426,7 @@ make_reference_type (type *type, type_code refcode)
 
   ntype = type_allocator (type).new_type ();
   ntype->set_target_type (type);
-  reftype = (refcode == TYPE_CODE_REF ? &TYPE_REFERENCE_TYPE (type)
+  reftype = (refcode == TYPE_CODE_REF ? &type->reference_type
 	     : &TYPE_RVALUE_REFERENCE_TYPE (type));
 
   *reftype = ntype;
@@ -615,7 +615,7 @@ make_qualified_type (struct type *type, type_instance_flags new_flags,
   /* Pointers or references to the original type are not relevant to
      the new type.  */
   ntype->pointer_type = (struct type *) 0;
-  TYPE_REFERENCE_TYPE (ntype) = (struct type *) 0;
+  ntype->reference_type = nullptr;
 
   /* Chain the new qualified type to the old type.  */
   TYPE_CHAIN (ntype) = TYPE_CHAIN (type);
@@ -4987,7 +4987,7 @@ recursive_dump_type (struct type *type, int spaces)
   gdb_printf ("%*spointer_type %s\n", spaces, "",
 	      host_address_to_string (type->pointer_type));
   gdb_printf ("%*sreference_type %s\n", spaces, "",
-	      host_address_to_string (TYPE_REFERENCE_TYPE (type)));
+	      host_address_to_string (type->reference_type));
   gdb_printf ("%*stype_chain %s\n", spaces, "",
 	      host_address_to_string (TYPE_CHAIN (type)));
   gdb_printf ("%*sinstance_flags 0x%x", spaces, "",
diff --git a/gdb/gdbtypes.h b/gdb/gdbtypes.h
index 5bbaa846dc3..e241da40280 100644
--- a/gdb/gdbtypes.h
+++ b/gdb/gdbtypes.h
@@ -1897,7 +1897,6 @@ extern void allocate_gnat_aux_type (struct type *);
   (TYPE_SPECIFIC_FIELD (type) = TYPE_SPECIFIC_FIXED_POINT, \
    allocate_fixed_point_type_info (type))
 
-#define TYPE_REFERENCE_TYPE(thistype) (thistype)->reference_type
 #define TYPE_RVALUE_REFERENCE_TYPE(thistype) (thistype)->rvalue_reference_type
 #define TYPE_CHAIN(thistype) (thistype)->chain
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.