aboutsummaryrefslogtreecommitdiff
path: root/gdb/gdbtypes.c
diff options
context:
space:
mode:
authorTom Tromey <tom@tromey.com>2023-03-13 12:25:27 -0600
committerTom Tromey <tom@tromey.com>2023-03-18 11:12:38 -0600
commit9c794d2d46f0605ee033107418aac2ca20f659f8 (patch)
treeab2545236e101a41e404ff7d6ceaeee6d5aeb97a /gdb/gdbtypes.c
parent0776344a3377b1ac01889b03e21f6ad20c267fa6 (diff)
downloadgdb-9c794d2d46f0605ee033107418aac2ca20f659f8.zip
gdb-9c794d2d46f0605ee033107418aac2ca20f659f8.tar.gz
gdb-9c794d2d46f0605ee033107418aac2ca20f659f8.tar.bz2
Unify arch_pointer_type and init_pointer_type
This unifies arch_pointer_type and init_pointer_type by using a type allocator. Reviewed-By: Simon Marchi <simon.marchi@efficios.com>
Diffstat (limited to 'gdb/gdbtypes.c')
-rw-r--r--gdb/gdbtypes.c28
1 files changed, 4 insertions, 24 deletions
diff --git a/gdb/gdbtypes.c b/gdb/gdbtypes.c
index df10ffe..103818f 100644
--- a/gdb/gdbtypes.c
+++ b/gdb/gdbtypes.c
@@ -3526,18 +3526,15 @@ init_complex_type (const char *name, struct type *target_type)
return TYPE_MAIN_TYPE (target_type)->flds_bnds.complex_type;
}
-/* Allocate a TYPE_CODE_PTR type structure associated with OBJFILE.
- BIT is the pointer type size in bits. NAME is the type name.
- TARGET_TYPE is the pointer target type. Always sets the pointer type's
- TYPE_UNSIGNED flag. */
+/* See gdbtypes.h. */
struct type *
-init_pointer_type (struct objfile *objfile,
+init_pointer_type (type_allocator &alloc,
int bit, const char *name, struct type *target_type)
{
struct type *t;
- t = type_allocator (objfile).new_type (TYPE_CODE_PTR, bit, name);
+ t = alloc.new_type (TYPE_CODE_PTR, bit, name);
t->set_target_type (target_type);
t->set_is_unsigned (true);
return t;
@@ -5740,23 +5737,6 @@ copy_type (const struct type *type)
/* Helper functions to initialize architecture-specific types. */
-/* Allocate a TYPE_CODE_PTR type structure associated with GDBARCH.
- BIT is the pointer type size in bits. NAME is the type name.
- TARGET_TYPE is the pointer target type. Always sets the pointer type's
- TYPE_UNSIGNED flag. */
-
-struct type *
-arch_pointer_type (struct gdbarch *gdbarch,
- int bit, const char *name, struct type *target_type)
-{
- struct type *t;
-
- t = type_allocator (gdbarch).new_type (TYPE_CODE_PTR, bit, name);
- t->set_target_type (target_type);
- t->set_is_unsigned (true);
- return t;
-}
-
/* Allocate a TYPE_CODE_FLAGS type structure associated with GDBARCH.
NAME is the type name. BIT is the size of the flag word in bits. */
@@ -6227,7 +6207,7 @@ objfile_type (struct objfile *objfile)
objfile_type->nodebug_text_gnu_ifunc_symbol->set_is_gnu_ifunc (true);
objfile_type->nodebug_got_plt_symbol
- = init_pointer_type (objfile, gdbarch_addr_bit (gdbarch),
+ = init_pointer_type (alloc, gdbarch_addr_bit (gdbarch),
"<text from jump slot in .got.plt, no debug info>",
objfile_type->nodebug_text_symbol);
objfile_type->nodebug_data_symbol