]> git.ipfire.org Git - thirdparty/binutils-gdb.git/commitdiff
gdb: remove make_reference_type typeptr parameter
authorSimon Marchi <simon.marchi@polymtl.ca>
Wed, 17 Dec 2025 15:54:57 +0000 (10:54 -0500)
committerSimon Marchi <simon.marchi@efficios.com>
Tue, 6 Jan 2026 19:59:15 +0000 (14:59 -0500)
It is always passed nullptr.

Change-Id: I1ec2afacb694c6d708df28ea6d47f08ceaf973db
Approved-By: Tom Tromey <tom@tromey.com>
gdb/gdbtypes.c
gdb/gdbtypes.h

index a70d6a9cc55f2a9c8da35173cca4195f322bc5cd..087f3393dfdc051e3c559e3f2fcf61b9a85b65a7 100644 (file)
@@ -407,15 +407,10 @@ lookup_pointer_type (struct type *type)
   return make_pointer_type (type);
 }
 
-/* Lookup a C++ `reference' to a type TYPE.  TYPEPTR, if nonzero,
-   points to a pointer to memory where the reference type should be
-   stored.  If *TYPEPTR is zero, update it to point to the reference
-   type we return.  We allocate new memory if needed. REFCODE denotes
-   the kind of reference type to lookup (lvalue or rvalue reference).  */
+/* See gdbtypes.h.  */
 
-struct type *
-make_reference_type (struct type *type, struct type **typeptr,
-                     enum type_code refcode)
+type *
+make_reference_type (type *type, type_code refcode)
 {
   struct type *ntype;  /* New type */
   struct type **reftype;
@@ -427,31 +422,9 @@ make_reference_type (struct type *type, struct type **typeptr,
           : TYPE_RVALUE_REFERENCE_TYPE (type));
 
   if (ntype)
-    {
-      if (typeptr == 0)
-       return ntype;           /* Don't care about alloc,
-                                  and have new type.  */
-      else if (*typeptr == 0)
-       {
-         *typeptr = ntype;     /* Tracking alloc, and have new type.  */
-         return ntype;
-       }
-    }
-
-  if (typeptr == 0 || *typeptr == 0)   /* We'll need to allocate one.  */
-    {
-      ntype = type_allocator (type).new_type ();
-      if (typeptr)
-       *typeptr = ntype;
-    }
-  else                 /* We have storage, but need to reset it.  */
-    {
-      ntype = *typeptr;
-      chain = TYPE_CHAIN (ntype);
-      smash_type (ntype);
-      TYPE_CHAIN (ntype) = chain;
-    }
+    return ntype;
 
+  ntype = type_allocator (type).new_type ();
   ntype->set_target_type (type);
   reftype = (refcode == TYPE_CODE_REF ? &TYPE_REFERENCE_TYPE (type)
             : &TYPE_RVALUE_REFERENCE_TYPE (type));
@@ -484,7 +457,7 @@ make_reference_type (struct type *type, struct type **typeptr,
 struct type *
 lookup_reference_type (struct type *type, enum type_code refcode)
 {
-  return make_reference_type (type, (struct type **) 0, refcode);
+  return make_reference_type (type, refcode);
 }
 
 /* Lookup the lvalue reference type for the type TYPE.  */
index c454ddcf8195ffa5ec25c9abd312eda6d64f3d47..1defdf80ddf4c3a92417e6fc2f8c9cc8bde004ea 100644 (file)
@@ -2432,9 +2432,10 @@ extern struct type *lookup_reference_type (struct type *, enum type_code);
 extern struct type *lookup_lvalue_reference_type (struct type *);
 extern struct type *lookup_rvalue_reference_type (struct type *);
 
+/* Lookup a C++ `reference' to a type TYPE.  REFCODE denotes the kind of
+   reference type to lookup (lvalue or rvalue reference).  */
 
-extern struct type *make_reference_type (struct type *, struct type **,
-                                        enum type_code);
+extern type *make_reference_type (type *type, type_code refcode);
 
 extern struct type *make_cv_type (int, int, struct type *, struct type **);