mirror of
https://github.com/espressif/binutils-gdb.git
synced 2025-06-17 07:53:51 +08:00
gdb: add type::bounds / type::set_bounds
Add the `bounds` and `set_bounds` methods on `struct type`, in order to remove the `TYPE_RANGE_DATA` macro. In this patch, the `TYPE_RANGE_DATA` macro is changed to use `type::bounds`, so all the call sites that are used to set a range type's bounds are changed to use `type::set_bounds`. The next patch will remove `TYPE_RANGE_DATA` completely. gdb/ChangeLog: * gdbtypes.h (struct type) <bounds, set_bounds>: New methods. (TYPE_RANGE_DATA): Use type::bounds. Change all uses that are used to set the range type's bounds to use set_bounds. Change-Id: I62e15506239b98404e62bbea8120db184ed87847
This commit is contained in:

committed by
Simon Marchi

parent
07716b63cb
commit
c4dfcb3638
@ -935,15 +935,17 @@ create_range_type (struct type *result_type, struct type *index_type,
|
||||
else
|
||||
TYPE_LENGTH (result_type) = TYPE_LENGTH (check_typedef (index_type));
|
||||
|
||||
TYPE_RANGE_DATA (result_type) = (struct range_bounds *)
|
||||
TYPE_ZALLOC (result_type, sizeof (struct range_bounds));
|
||||
TYPE_RANGE_DATA (result_type)->low = *low_bound;
|
||||
TYPE_RANGE_DATA (result_type)->high = *high_bound;
|
||||
TYPE_RANGE_DATA (result_type)->bias = bias;
|
||||
range_bounds *bounds
|
||||
= (struct range_bounds *) TYPE_ZALLOC (result_type, sizeof (range_bounds));
|
||||
bounds->low = *low_bound;
|
||||
bounds->high = *high_bound;
|
||||
bounds->bias = bias;
|
||||
|
||||
/* Initialize the stride to be a constant, the value will already be zero
|
||||
thanks to the use of TYPE_ZALLOC above. */
|
||||
TYPE_RANGE_DATA (result_type)->stride.kind = PROP_CONST;
|
||||
bounds->stride.kind = PROP_CONST;
|
||||
|
||||
result_type->set_bounds (bounds);
|
||||
|
||||
if (low_bound->kind == PROP_CONST && low_bound->data.const_val >= 0)
|
||||
TYPE_UNSIGNED (result_type) = 1;
|
||||
@ -5363,9 +5365,12 @@ copy_type_recursive (struct objfile *objfile,
|
||||
/* For range types, copy the bounds information. */
|
||||
if (type->code () == TYPE_CODE_RANGE)
|
||||
{
|
||||
TYPE_RANGE_DATA (new_type) = (struct range_bounds *)
|
||||
TYPE_ALLOC (new_type, sizeof (struct range_bounds));
|
||||
*TYPE_RANGE_DATA (new_type) = *TYPE_RANGE_DATA (type);
|
||||
range_bounds *bounds
|
||||
= ((struct range_bounds *) TYPE_ALLOC
|
||||
(new_type, sizeof (struct range_bounds)));
|
||||
|
||||
*bounds = *type->bounds ();
|
||||
new_type->set_bounds (bounds);
|
||||
}
|
||||
|
||||
if (type->main_type->dyn_prop_list != NULL)
|
||||
|
Reference in New Issue
Block a user