forked from Imagelibrary/binutils-gdb
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>
This commit is contained in:
@@ -164,10 +164,7 @@ convert_func (compile_c_instance *context, struct type *type)
|
|||||||
GDB's parser used to do. */
|
GDB's parser used to do. */
|
||||||
if (target_type == NULL)
|
if (target_type == NULL)
|
||||||
{
|
{
|
||||||
if (type->is_objfile_owned ())
|
target_type = builtin_type (type->arch ())->builtin_int;
|
||||||
target_type = objfile_type (type->objfile_owner ())->builtin_int;
|
|
||||||
else
|
|
||||||
target_type = builtin_type (type->arch_owner ())->builtin_int;
|
|
||||||
warning (_("function has unknown return type; assuming 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
|
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 does. For now, assume "int" like GDB's
|
||||||
built-in parser used to do, but at least warn. */
|
built-in parser used to do, but at least warn. */
|
||||||
struct type *fallback;
|
struct type *fallback = builtin_type (type->arch ())->builtin_int;
|
||||||
if (type->is_objfile_owned ())
|
|
||||||
fallback = objfile_type (type->objfile_owner ())->builtin_int;
|
|
||||||
else
|
|
||||||
fallback = builtin_type (type->arch_owner ())->builtin_int;
|
|
||||||
warning (_("variable has unknown type; assuming int"));
|
warning (_("variable has unknown type; assuming int"));
|
||||||
return convert_int (context, fallback);
|
return convert_int (context, fallback);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -969,10 +969,7 @@ compile_cplus_convert_func (compile_cplus_instance *instance,
|
|||||||
GDB's parser used to do. */
|
GDB's parser used to do. */
|
||||||
if (target_type == nullptr)
|
if (target_type == nullptr)
|
||||||
{
|
{
|
||||||
if (type->is_objfile_owned ())
|
target_type = builtin_type (type->arch ())->builtin_int;
|
||||||
target_type = objfile_type (type->objfile_owner ())->builtin_int;
|
|
||||||
else
|
|
||||||
target_type = builtin_type (type->arch_owner ())->builtin_int;
|
|
||||||
warning (_("function has unknown return type; assuming int"));
|
warning (_("function has unknown return type; assuming int"));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1407,10 +1407,7 @@ lookup_array_range_type (struct type *element_type,
|
|||||||
struct type *range_type;
|
struct type *range_type;
|
||||||
|
|
||||||
type_allocator alloc (element_type);
|
type_allocator alloc (element_type);
|
||||||
if (element_type->is_objfile_owned ())
|
index_type = builtin_type (element_type->arch ())->builtin_int;
|
||||||
index_type = objfile_type (element_type->objfile_owner ())->builtin_int;
|
|
||||||
else
|
|
||||||
index_type = builtin_type (element_type->arch_owner ())->builtin_int;
|
|
||||||
|
|
||||||
range_type = create_static_range_type (alloc, index_type,
|
range_type = create_static_range_type (alloc, index_type,
|
||||||
low_bound, high_bound);
|
low_bound, high_bound);
|
||||||
|
|||||||
Reference in New Issue
Block a user