[binutils-gdb] Pass a type allocator to init_fixed_point_type

Tom Tromey tromey@sourceware.org
Tue Sep 19 19:34:11 GMT 2023


https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=d559227272d72e554222361058163b9dc94de2f0

commit d559227272d72e554222361058163b9dc94de2f0
Author: Tom Tromey <tromey@adacore.com>
Date:   Tue Sep 5 12:43:50 2023 -0600

    Pass a type allocator to init_fixed_point_type
    
    init_fixed_point_type currently takes an objfile and creates its own
    type allocator.  However, for a later patch it is more convenient if
    this function accepts a type allocator.  This patch makes this change.

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

diff --git a/gdb/dwarf2/read.c b/gdb/dwarf2/read.c
index 0f4d99109fb..40cdc166826 100644
--- a/gdb/dwarf2/read.c
+++ b/gdb/dwarf2/read.c
@@ -15380,11 +15380,11 @@ read_base_type (struct die_info *die, struct dwarf2_cu *cu)
 	}
 	break;
       case DW_ATE_signed_fixed:
-	type = init_fixed_point_type (objfile, bits, 0, name);
+	type = init_fixed_point_type (alloc, bits, 0, name);
 	finish_fixed_point_type (type, gnat_encoding_suffix, die, cu);
 	break;
       case DW_ATE_unsigned_fixed:
-	type = init_fixed_point_type (objfile, bits, 1, name);
+	type = init_fixed_point_type (alloc, bits, 1, name);
 	finish_fixed_point_type (type, gnat_encoding_suffix, die, cu);
 	break;
 
diff --git a/gdb/gdbtypes.c b/gdb/gdbtypes.c
index c9322108299..667b4e34a24 100644
--- a/gdb/gdbtypes.c
+++ b/gdb/gdbtypes.c
@@ -3498,12 +3498,12 @@ init_pointer_type (type_allocator &alloc,
    NAME is the type name.  */
 
 struct type *
-init_fixed_point_type (struct objfile *objfile,
+init_fixed_point_type (type_allocator &alloc,
 		       int bit, int unsigned_p, const char *name)
 {
   struct type *t;
 
-  t = type_allocator (objfile).new_type (TYPE_CODE_FIXED_POINT, bit, name);
+  t = alloc.new_type (TYPE_CODE_FIXED_POINT, bit, name);
   if (unsigned_p)
     t->set_is_unsigned (true);
 
diff --git a/gdb/gdbtypes.h b/gdb/gdbtypes.h
index f667b10ec7d..df94e952c1f 100644
--- a/gdb/gdbtypes.h
+++ b/gdb/gdbtypes.h
@@ -2379,7 +2379,7 @@ extern struct type *init_pointer_type (type_allocator &alloc, int bit,
 				       const char *name,
 				       struct type *target_type);
 
-extern struct type *init_fixed_point_type (struct objfile *, int, int,
+extern struct type *init_fixed_point_type (type_allocator &, int, int,
 					   const char *);
 
 /* Helper functions to construct a struct or record type.  An


More information about the Gdb-cvs mailing list