Reuse existing builtin types

This changes a few spots to reuse the existing builting "void" type,
rather than construct a new one.

Reviewed-By: Simon Marchi <simon.marchi@efficios.com>
This commit is contained in:
Tom Tromey
2023-03-13 09:31:13 -06:00
parent 8a17bdd9cc
commit 95751990e4
5 changed files with 5 additions and 11 deletions

View File

@@ -201,8 +201,7 @@ build_d_types (struct gdbarch *gdbarch)
struct builtin_d_type *builtin_d_type = new struct builtin_d_type; struct builtin_d_type *builtin_d_type = new struct builtin_d_type;
/* Basic types. */ /* Basic types. */
builtin_d_type->builtin_void builtin_d_type->builtin_void = builtin_type (gdbarch)->builtin_void;
= arch_type (gdbarch, TYPE_CODE_VOID, TARGET_CHAR_BIT, "void");
builtin_d_type->builtin_bool builtin_d_type->builtin_bool
= arch_boolean_type (gdbarch, 8, 1, "bool"); = arch_boolean_type (gdbarch, 8, 1, "bool");
builtin_d_type->builtin_byte builtin_d_type->builtin_byte

View File

@@ -1725,8 +1725,7 @@ build_fortran_types (struct gdbarch *gdbarch)
{ {
struct builtin_f_type *builtin_f_type = new struct builtin_f_type; struct builtin_f_type *builtin_f_type = new struct builtin_f_type;
builtin_f_type->builtin_void builtin_f_type->builtin_void = builtin_type (gdbarch)->builtin_void;
= arch_type (gdbarch, TYPE_CODE_VOID, TARGET_CHAR_BIT, "void");
builtin_f_type->builtin_character builtin_f_type->builtin_character
= arch_type (gdbarch, TYPE_CODE_CHAR, TARGET_CHAR_BIT, "character"); = arch_type (gdbarch, TYPE_CODE_CHAR, TARGET_CHAR_BIT, "character");

View File

@@ -483,8 +483,7 @@ build_go_types (struct gdbarch *gdbarch)
{ {
struct builtin_go_type *builtin_go_type = new struct builtin_go_type; struct builtin_go_type *builtin_go_type = new struct builtin_go_type;
builtin_go_type->builtin_void builtin_go_type->builtin_void = builtin_type (gdbarch)->builtin_void;
= arch_type (gdbarch, TYPE_CODE_VOID, TARGET_CHAR_BIT, "void");
builtin_go_type->builtin_char builtin_go_type->builtin_char
= arch_character_type (gdbarch, 8, 1, "char"); = arch_character_type (gdbarch, 8, 1, "char");
builtin_go_type->builtin_bool builtin_go_type->builtin_bool

View File

@@ -571,10 +571,7 @@ finalize_symtab (struct gdb_symtab *stab, struct objfile *objfile)
{ {
struct block *new_block = new (&objfile->objfile_obstack) block; struct block *new_block = new (&objfile->objfile_obstack) block;
struct symbol *block_name = new (&objfile->objfile_obstack) symbol; struct symbol *block_name = new (&objfile->objfile_obstack) symbol;
struct type *block_type = arch_type (objfile->arch (), struct type *block_type = builtin_type (objfile->arch ())->builtin_void;
TYPE_CODE_VOID,
TARGET_CHAR_BIT,
"void");
new_block->set_multidict new_block->set_multidict
(mdict_create_linear (&objfile->objfile_obstack, NULL)); (mdict_create_linear (&objfile->objfile_obstack, NULL));

View File

@@ -941,7 +941,7 @@ public:
add (arch_integer_type (gdbarch, gdbarch_ptr_bit (gdbarch), 0, "ptrdiff_t")); add (arch_integer_type (gdbarch, gdbarch_ptr_bit (gdbarch), 0, "ptrdiff_t"));
add (arch_integer_type (gdbarch, gdbarch_ptr_bit (gdbarch), 0, "intptr_t")); add (arch_integer_type (gdbarch, gdbarch_ptr_bit (gdbarch), 0, "intptr_t"));
add (arch_integer_type (gdbarch, gdbarch_ptr_bit (gdbarch), 1, "uintptr_t")); add (arch_integer_type (gdbarch, gdbarch_ptr_bit (gdbarch), 1, "uintptr_t"));
add (arch_type (gdbarch, TYPE_CODE_VOID, TARGET_CHAR_BIT, "void")); add (builtin_type (gdbarch)->builtin_void);
/* Type of elements of strings. */ /* Type of elements of strings. */
lai->set_string_char_type (char_type); lai->set_string_char_type (char_type);