From: Tom Tromey <tom@tromey.com>
To: gdb-patches@sourceware.org
Subject: [PATCH 17/20] Use builtin type when appropriate
Date: Mon, 13 Mar 2023 16:08:17 -0600 [thread overview]
Message-ID: <20230313-split-objfile-type-allocator-2-v1-17-69ba773ac17b@tromey.com> (raw)
In-Reply-To: <20230313-split-objfile-type-allocator-2-v1-0-69ba773ac17b@tromey.com>
There are a few spots that check whether a type is objfile-owned, and
then choose either the objfile- or arch-specific builtin type. I
don't think there is a need to do this any more (if there ever was),
because it is ok for an objfile-allocated type to refer to an
arch-allocated type.
---
gdb/compile/compile-c-types.c | 11 ++---------
gdb/compile/compile-cplus-types.c | 5 +----
gdb/gdbtypes.c | 5 +----
3 files changed, 4 insertions(+), 17 deletions(-)
diff --git a/gdb/compile/compile-c-types.c b/gdb/compile/compile-c-types.c
index 68903c27a97..f48eca2152a 100644
--- a/gdb/compile/compile-c-types.c
+++ b/gdb/compile/compile-c-types.c
@@ -164,10 +164,7 @@ convert_func (compile_c_instance *context, struct type *type)
GDB's parser used to do. */
if (target_type == NULL)
{
- if (type->is_objfile_owned ())
- target_type = objfile_type (type->objfile_owner ())->builtin_int;
- else
- target_type = builtin_type (type->arch_owner ())->builtin_int;
+ target_type = builtin_type (type->arch ())->builtin_int;
warning (_("function has unknown return type; assuming int"));
}
@@ -322,11 +319,7 @@ convert_type_basic (compile_c_instance *context, struct type *type)
the cast-to type as the variable's type, like GDB's
built-in parser does. For now, assume "int" like GDB's
built-in parser used to do, but at least warn. */
- struct type *fallback;
- if (type->is_objfile_owned ())
- fallback = objfile_type (type->objfile_owner ())->builtin_int;
- else
- fallback = builtin_type (type->arch_owner ())->builtin_int;
+ struct type *fallback = builtin_type (type->arch ())->builtin_int;
warning (_("variable has unknown type; assuming int"));
return convert_int (context, fallback);
}
diff --git a/gdb/compile/compile-cplus-types.c b/gdb/compile/compile-cplus-types.c
index d48aa61b4bc..47cb26785fc 100644
--- a/gdb/compile/compile-cplus-types.c
+++ b/gdb/compile/compile-cplus-types.c
@@ -969,10 +969,7 @@ compile_cplus_convert_func (compile_cplus_instance *instance,
GDB's parser used to do. */
if (target_type == nullptr)
{
- if (type->is_objfile_owned ())
- target_type = objfile_type (type->objfile_owner ())->builtin_int;
- else
- target_type = builtin_type (type->arch_owner ())->builtin_int;
+ target_type = builtin_type (type->arch ())->builtin_int;
warning (_("function has unknown return type; assuming int"));
}
diff --git a/gdb/gdbtypes.c b/gdb/gdbtypes.c
index 8093a3911d7..a167308dc8f 100644
--- a/gdb/gdbtypes.c
+++ b/gdb/gdbtypes.c
@@ -1408,10 +1408,7 @@ lookup_array_range_type (struct type *element_type,
struct type *range_type;
type_allocator alloc (element_type);
- if (element_type->is_objfile_owned ())
- index_type = objfile_type (element_type->objfile_owner ())->builtin_int;
- else
- index_type = builtin_type (element_type->arch_owner ())->builtin_int;
+ index_type = builtin_type (element_type->arch ())->builtin_int;
range_type = create_static_range_type (alloc, index_type,
low_bound, high_bound);
--
2.39.1
next prev parent reply other threads:[~2023-03-13 22:08 UTC|newest]
Thread overview: 25+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-03-13 22:08 [PATCH 00/20] Remove objfile_type Tom Tromey
2023-03-13 22:08 ` [PATCH 01/20] Introduce type_allocator Tom Tromey
2023-03-13 22:08 ` [PATCH 02/20] Remove alloc_type_arch Tom Tromey
2023-03-13 22:08 ` [PATCH 03/20] Remove alloc_type_copy Tom Tromey
2023-03-13 22:08 ` [PATCH 04/20] Remove alloc_type Tom Tromey
2023-03-13 22:08 ` [PATCH 05/20] Reuse existing builtin types Tom Tromey
2023-03-13 22:08 ` [PATCH 06/20] Remove arch_type Tom Tromey
2023-03-13 22:08 ` [PATCH 07/20] Remove init_type Tom Tromey
2023-03-13 22:08 ` [PATCH 08/20] Unify arch_integer_type and init_integer_type Tom Tromey
2023-03-13 22:08 ` [PATCH 09/20] Unify arch_character_type and init_character_type Tom Tromey
2023-03-13 22:08 ` [PATCH 10/20] Unify arch_boolean_type and init_boolean_type Tom Tromey
2023-03-13 22:08 ` [PATCH 11/20] Unify arch_float_type and init_float_type Tom Tromey
2023-03-13 22:08 ` [PATCH 12/20] Unify arch_decfloat_type and init_decfloat_type Tom Tromey
2023-03-13 22:08 ` [PATCH 13/20] Unify arch_pointer_type and init_pointer_type Tom Tromey
2023-03-13 22:08 ` [PATCH 14/20] Use type allocator for range types Tom Tromey
2023-03-14 14:41 ` Simon Marchi
2023-03-18 15:56 ` Tom Tromey
2023-03-13 22:08 ` [PATCH 15/20] Use type allocator for array types Tom Tromey
2023-03-13 22:08 ` [PATCH 16/20] Use type allocator for set types Tom Tromey
2023-03-13 22:08 ` Tom Tromey [this message]
2023-03-13 22:08 ` [PATCH 18/20] Rename objfile_type to builtin_type Tom Tromey
2023-03-13 22:08 ` [PATCH 19/20] Add some types to struct builtin_type Tom Tromey
2023-03-13 22:08 ` [PATCH 20/20] Remove objfile_type Tom Tromey
2023-03-14 14:48 ` [PATCH 00/20] " Simon Marchi
2023-03-18 15:57 ` Tom Tromey
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20230313-split-objfile-type-allocator-2-v1-17-69ba773ac17b@tromey.com \
--to=tom@tromey.com \
--cc=gdb-patches@sourceware.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).