Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: Simon Marchi <simon.marchi@efficios.com>
To: gdb-patches@sourceware.org
Cc: Simon Marchi <simon.marchi@polymtl.ca>
Subject: [PATCH 4/6] gdb: remove TYPE_REFERENCE_TYPE
Date: Mon, 16 Mar 2026 10:25:21 -0400	[thread overview]
Message-ID: <20260316142645.26877-5-simon.marchi@efficios.com> (raw)
In-Reply-To: <20260316142645.26877-1-simon.marchi@efficios.com>

From: Simon Marchi <simon.marchi@polymtl.ca>

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
---
 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 b6b6a95b8a6c..feea1e9333be 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);
@@ -4985,7 +4985,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 5bbaa846dc33..e241da402808 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
 
-- 
2.53.0


  parent reply	other threads:[~2026-03-16 14:27 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-03-16 14:25 [PATCH 0/6] Remove some trivial TYPE_* macros Simon Marchi
2026-03-16 14:25 ` [PATCH 1/6] gdb: remove INIT_NONE_SPECIFIC Simon Marchi
2026-03-16 14:25 ` [PATCH 2/6] gdb: remove TYPE_MAIN_TYPE Simon Marchi
2026-03-16 14:25 ` [PATCH 3/6] gdb: remove TYPE_POINTER_TYPE Simon Marchi
2026-03-16 14:25 ` Simon Marchi [this message]
2026-03-16 14:25 ` [PATCH 5/6] gdb: remove TYPE_RVALUE_REFERENCE_TYPE Simon Marchi
2026-03-16 14:25 ` [PATCH 6/6] gdb: remove TYPE_CHAIN Simon Marchi
2026-03-16 17:16 ` [PATCH 0/6] Remove some trivial TYPE_* macros Andrew Burgess
2026-03-16 17:28   ` Simon Marchi
2026-03-19 14:34   ` Tom Tromey

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20260316142645.26877-5-simon.marchi@efficios.com \
    --to=simon.marchi@efficios.com \
    --cc=gdb-patches@sourceware.org \
    --cc=simon.marchi@polymtl.ca \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox