From: Tom Tromey Date: Mon, 13 Mar 2023 15:31:13 +0000 (-0600) Subject: Reuse existing builtin types X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=95751990e40d88986205ba3c0719b8afd3da0e7e;p=binutils-gdb.git 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 --- diff --git a/gdb/d-lang.c b/gdb/d-lang.c index 8286c5be646..457e367fd51 100644 --- a/gdb/d-lang.c +++ b/gdb/d-lang.c @@ -201,8 +201,7 @@ build_d_types (struct gdbarch *gdbarch) struct builtin_d_type *builtin_d_type = new struct builtin_d_type; /* Basic types. */ - builtin_d_type->builtin_void - = arch_type (gdbarch, TYPE_CODE_VOID, TARGET_CHAR_BIT, "void"); + builtin_d_type->builtin_void = builtin_type (gdbarch)->builtin_void; builtin_d_type->builtin_bool = arch_boolean_type (gdbarch, 8, 1, "bool"); builtin_d_type->builtin_byte diff --git a/gdb/f-lang.c b/gdb/f-lang.c index 0d7863e4fd1..e1eb47577d6 100644 --- a/gdb/f-lang.c +++ b/gdb/f-lang.c @@ -1725,8 +1725,7 @@ build_fortran_types (struct gdbarch *gdbarch) { struct builtin_f_type *builtin_f_type = new struct builtin_f_type; - builtin_f_type->builtin_void - = arch_type (gdbarch, TYPE_CODE_VOID, TARGET_CHAR_BIT, "void"); + builtin_f_type->builtin_void = builtin_type (gdbarch)->builtin_void; builtin_f_type->builtin_character = arch_type (gdbarch, TYPE_CODE_CHAR, TARGET_CHAR_BIT, "character"); diff --git a/gdb/go-lang.c b/gdb/go-lang.c index bbf80af1f5c..456b74d80df 100644 --- a/gdb/go-lang.c +++ b/gdb/go-lang.c @@ -483,8 +483,7 @@ build_go_types (struct gdbarch *gdbarch) { struct builtin_go_type *builtin_go_type = new struct builtin_go_type; - builtin_go_type->builtin_void - = arch_type (gdbarch, TYPE_CODE_VOID, TARGET_CHAR_BIT, "void"); + builtin_go_type->builtin_void = builtin_type (gdbarch)->builtin_void; builtin_go_type->builtin_char = arch_character_type (gdbarch, 8, 1, "char"); builtin_go_type->builtin_bool diff --git a/gdb/jit.c b/gdb/jit.c index 52b65746f11..e276b3417a0 100644 --- a/gdb/jit.c +++ b/gdb/jit.c @@ -571,10 +571,7 @@ finalize_symtab (struct gdb_symtab *stab, struct objfile *objfile) { struct block *new_block = new (&objfile->objfile_obstack) block; struct symbol *block_name = new (&objfile->objfile_obstack) symbol; - struct type *block_type = arch_type (objfile->arch (), - TYPE_CODE_VOID, - TARGET_CHAR_BIT, - "void"); + struct type *block_type = builtin_type (objfile->arch ())->builtin_void; new_block->set_multidict (mdict_create_linear (&objfile->objfile_obstack, NULL)); diff --git a/gdb/opencl-lang.c b/gdb/opencl-lang.c index ae1a6d4446d..9b5304f588f 100644 --- a/gdb/opencl-lang.c +++ b/gdb/opencl-lang.c @@ -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, "intptr_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. */ lai->set_string_char_type (char_type);