diff options
author | Tom Tromey <tom@tromey.com> | 2023-03-13 10:57:56 -0600 |
---|---|---|
committer | Tom Tromey <tom@tromey.com> | 2023-03-18 11:12:37 -0600 |
commit | f50b437c3da71d91dfb04db8e06b2cdb69d16294 (patch) | |
tree | ee0a8bab9c7fb41f789f1ef934776d98586f88fc /gdb/gdbtypes.c | |
parent | 2d39ccd3d1773b26ed8178bcd77375175c48ee62 (diff) | |
download | gdb-f50b437c3da71d91dfb04db8e06b2cdb69d16294.zip gdb-f50b437c3da71d91dfb04db8e06b2cdb69d16294.tar.gz gdb-f50b437c3da71d91dfb04db8e06b2cdb69d16294.tar.bz2 |
Unify arch_character_type and init_character_type
This unifies arch_character_type and init_character_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.c | 29 |
1 files changed, 5 insertions, 24 deletions
diff --git a/gdb/gdbtypes.c b/gdb/gdbtypes.c index f5ddc86..49f88ce 100644 --- a/gdb/gdbtypes.c +++ b/gdb/gdbtypes.c @@ -3417,17 +3417,15 @@ init_integer_type (type_allocator &alloc, return t; } -/* Allocate a TYPE_CODE_CHAR type structure associated with OBJFILE. - BIT is the type size in bits. If UNSIGNED_P is non-zero, set - the type's TYPE_UNSIGNED flag. NAME is the type name. */ +/* See gdbtypes.h. */ struct type * -init_character_type (struct objfile *objfile, +init_character_type (type_allocator &alloc, int bit, int unsigned_p, const char *name) { struct type *t; - t = type_allocator (objfile).new_type (TYPE_CODE_CHAR, bit, name); + t = alloc.new_type (TYPE_CODE_CHAR, bit, name); if (unsigned_p) t->set_is_unsigned (true); @@ -5750,23 +5748,6 @@ copy_type (const struct type *type) /* Helper functions to initialize architecture-specific types. */ -/* Allocate a TYPE_CODE_CHAR type structure associated with GDBARCH. - BIT is the type size in bits. If UNSIGNED_P is non-zero, set - the type's TYPE_UNSIGNED flag. NAME is the type name. */ - -struct type * -arch_character_type (struct gdbarch *gdbarch, - int bit, int unsigned_p, const char *name) -{ - struct type *t; - - t = type_allocator (gdbarch).new_type (TYPE_CODE_CHAR, bit, name); - if (unsigned_p) - t->set_is_unsigned (true); - - return t; -} - /* Allocate a TYPE_CODE_BOOL type structure associated with GDBARCH. BIT is the type size in bits. If UNSIGNED_P is non-zero, set the type's TYPE_UNSIGNED flag. NAME is the type name. */ @@ -6135,9 +6116,9 @@ create_gdbtypes_data (struct gdbarch *gdbarch) /* "True" character types. */ builtin_type->builtin_true_char - = arch_character_type (gdbarch, TARGET_CHAR_BIT, 0, "true character"); + = init_character_type (alloc, TARGET_CHAR_BIT, 0, "true character"); builtin_type->builtin_true_unsigned_char - = arch_character_type (gdbarch, TARGET_CHAR_BIT, 1, "true character"); + = init_character_type (alloc, TARGET_CHAR_BIT, 1, "true character"); /* Fixed-size integer types. */ builtin_type->builtin_int0 |