mirror of
https://github.com/bminor/binutils-gdb.git
synced 2025-12-26 09:08:59 +00:00
* gdbtypes.c (lookup_array_range_type): Add prototype.
(lookup_string_range_type): Likewise. * gdbtypes.c (lookup_array_range_type): New function. (lookup_string_range_type): Likewise. * ax-gdb.c (gen_repeat): Use lookup_array_range_type. * parse.c (follow_types): Likewise. * jv-lang.c (java_array_type): Likewise. * gnu-v3-abi.c (build_gdb_vtable_type): Likewise. * mt-tdep.c (mt_register_type): Likewise. * sh-tdep.c (sh_sh4_build_float_register_type): Likewise. * sh64-tdep.c (sh64_build_float_register_type): Likewise. * value.c (allocate_repeat_value): Likewise. * valops.c (value_array, value_cstring): Likewise. * valops.c (value_string): Use lookup_string_range_type.
This commit is contained in:
@@ -833,6 +833,17 @@ create_array_type (struct type *result_type,
|
||||
return result_type;
|
||||
}
|
||||
|
||||
struct type *
|
||||
lookup_array_range_type (struct type *element_type,
|
||||
int low_bound, int high_bound)
|
||||
{
|
||||
struct gdbarch *gdbarch = current_gdbarch;
|
||||
struct type *index_type = builtin_type (gdbarch)->builtin_int;
|
||||
struct type *range_type
|
||||
= create_range_type (NULL, index_type, low_bound, high_bound);
|
||||
return create_array_type (NULL, element_type, range_type);
|
||||
}
|
||||
|
||||
/* Create a string type using either a blank type supplied in
|
||||
RESULT_TYPE, or creating a new type. String types are similar
|
||||
enough to array of char types that we can use create_array_type to
|
||||
@@ -857,6 +868,17 @@ create_string_type (struct type *result_type,
|
||||
return result_type;
|
||||
}
|
||||
|
||||
struct type *
|
||||
lookup_string_range_type (struct type *string_char_type,
|
||||
int low_bound, int high_bound)
|
||||
{
|
||||
struct type *result_type;
|
||||
result_type = lookup_array_range_type (string_char_type,
|
||||
low_bound, high_bound);
|
||||
TYPE_CODE (result_type) = TYPE_CODE_STRING;
|
||||
return result_type;
|
||||
}
|
||||
|
||||
struct type *
|
||||
create_set_type (struct type *result_type, struct type *domain_type)
|
||||
{
|
||||
@@ -947,11 +969,7 @@ struct type *
|
||||
init_vector_type (struct type *elt_type, int n)
|
||||
{
|
||||
struct type *array_type;
|
||||
|
||||
array_type = create_array_type (0, elt_type,
|
||||
create_range_type (0,
|
||||
builtin_type_int32,
|
||||
0, n-1));
|
||||
array_type = lookup_array_range_type (elt_type, 0, n - 1);
|
||||
make_vector_type (array_type);
|
||||
return array_type;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user