summaryrefslogtreecommitdiff
path: root/gdb/compile/compile-c-types.c
diff options
context:
space:
mode:
authorTom Tromey <tom@tromey.com>2023-03-11 09:37:15 -0700
committerTom Tromey <tom@tromey.com>2023-03-18 11:12:38 -0600
commit426e5b66a738f4de185410a3e47a61423e0a7bdf (patch)
treecdd4cf12f4152688f4d46a7841d2ec27e3c90632 /gdb/compile/compile-c-types.c
parent526648585ca87251acdda0a271f7c4b4591231ae (diff)
downloadbinutils-gdb-426e5b66a738f4de185410a3e47a61423e0a7bdf.tar.gz
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>
Diffstat (limited to 'gdb/compile/compile-c-types.c')
-rw-r--r--gdb/compile/compile-c-types.c11
1 files changed, 2 insertions, 9 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);
}