public inbox for gdb-cvs@sourceware.org
help / color / mirror / Atom feed
* [binutils-gdb] Use builtin type when appropriate
@ 2023-03-18 17:20 Tom Tromey
  0 siblings, 0 replies; only message in thread
From: Tom Tromey @ 2023-03-18 17:20 UTC (permalink / raw)
  To: gdb-cvs

https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=426e5b66a738f4de185410a3e47a61423e0a7bdf

commit 426e5b66a738f4de185410a3e47a61423e0a7bdf
Author: Tom Tromey <tom@tromey.com>
Date:   Sat Mar 11 09:37:15 2023 -0700

    Use builtin type when appropriate
    
    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.
    
    Reviewed-By: Simon Marchi <simon.marchi@efficios.com>

Diff:
---
 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 1b0adbdbe05..6f206d8b050 100644
--- a/gdb/gdbtypes.c
+++ b/gdb/gdbtypes.c
@@ -1407,10 +1407,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);

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2023-03-18 17:20 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-03-18 17:20 [binutils-gdb] Use builtin type when appropriate Tom Tromey

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).