gdb: remove TYPE_RANGE_DATA macro
Remove it in favor of using type::bounds directly. gdb/ChangeLog: * gdbtypes.h (TYPE_RANGE_DATA): Remove. Update callers to use the type::bounds method directly. Change-Id: Id4fab22af0a94cbf505f78b01b3ee5b3d682fba2
This commit is contained in:
parent
c4dfcb3638
commit
599088e3ff
11 changed files with 34 additions and 32 deletions
|
@ -1,3 +1,8 @@
|
|||
2020-07-12 Simon Marchi <simon.marchi@polymtl.ca>
|
||||
|
||||
* gdbtypes.h (TYPE_RANGE_DATA): Remove. Update callers to use
|
||||
the type::bounds method directly.
|
||||
|
||||
2020-07-12 Simon Marchi <simon.marchi@efficios.com>
|
||||
|
||||
* gdbtypes.h (struct type) <bounds, set_bounds>: New methods.
|
||||
|
|
|
@ -2250,7 +2250,7 @@ has_negatives (struct type *type)
|
|||
case TYPE_CODE_INT:
|
||||
return !TYPE_UNSIGNED (type);
|
||||
case TYPE_CODE_RANGE:
|
||||
return TYPE_LOW_BOUND (type) - TYPE_RANGE_DATA (type)->bias < 0;
|
||||
return TYPE_LOW_BOUND (type) - type->bounds ()->bias < 0;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -504,7 +504,7 @@ generate_vla_size (compile_instance *compiler,
|
|||
if (TYPE_HIGH_BOUND_KIND (type) == PROP_LOCEXPR
|
||||
|| TYPE_HIGH_BOUND_KIND (type) == PROP_LOCLIST)
|
||||
{
|
||||
const struct dynamic_prop *prop = &TYPE_RANGE_DATA (type)->high;
|
||||
const struct dynamic_prop *prop = &type->bounds ()->high;
|
||||
std::string name = c_get_range_decl_name (prop);
|
||||
|
||||
dwarf2_compile_property_to_c (stream, name.c_str (),
|
||||
|
|
|
@ -61,7 +61,7 @@ convert_array (compile_c_instance *context, struct type *type)
|
|||
" is not supported"));
|
||||
|
||||
std::string upper_bound
|
||||
= c_get_range_decl_name (&TYPE_RANGE_DATA (range)->high);
|
||||
= c_get_range_decl_name (&range->bounds ()->high);
|
||||
result = context->plugin ().build_vla_array_type (element_type,
|
||||
upper_bound.c_str ());
|
||||
return result;
|
||||
|
|
|
@ -483,7 +483,7 @@ compile_cplus_convert_array (compile_cplus_instance *instance,
|
|||
}
|
||||
|
||||
std::string upper_bound
|
||||
= c_get_range_decl_name (&TYPE_RANGE_DATA (range)->high);
|
||||
= c_get_range_decl_name (&range->bounds ()->high);
|
||||
return instance->plugin ().build_vla_array_type (element_type,
|
||||
upper_bound.c_str ());
|
||||
}
|
||||
|
|
|
@ -17958,7 +17958,7 @@ read_subrange_type (struct die_info *die, struct dwarf2_cu *cu)
|
|||
range_type = create_range_type (NULL, orig_base_type, &low, &high, bias);
|
||||
|
||||
if (high_bound_is_count)
|
||||
TYPE_RANGE_DATA (range_type)->flag_upper_bound_is_count = 1;
|
||||
range_type->bounds ()->flag_upper_bound_is_count = 1;
|
||||
|
||||
/* Ada expects an empty array on no boundary attributes. */
|
||||
if (attr == NULL && cu->language != language_ada)
|
||||
|
|
|
@ -3255,7 +3255,7 @@ evaluate_subexp_for_sizeof (struct expression *exp, int *pos,
|
|||
type = type->index_type ();
|
||||
/* Only re-evaluate the right hand side if the resulting type
|
||||
is a variable length type. */
|
||||
if (TYPE_RANGE_DATA (type)->flag_bound_evaluated)
|
||||
if (type->bounds ()->flag_bound_evaluated)
|
||||
{
|
||||
val = evaluate_subexp (NULL_TYPE, exp, pos, EVAL_NORMAL);
|
||||
return value_from_longest
|
||||
|
|
|
@ -978,8 +978,8 @@ create_range_type_with_stride (struct type *result_type,
|
|||
high_bound, bias);
|
||||
|
||||
gdb_assert (stride != nullptr);
|
||||
TYPE_RANGE_DATA (result_type)->stride = *stride;
|
||||
TYPE_RANGE_DATA (result_type)->flag_is_byte_stride = byte_stride_p;
|
||||
result_type->bounds ()->stride = *stride;
|
||||
result_type->bounds ()->flag_is_byte_stride = byte_stride_p;
|
||||
|
||||
return result_type;
|
||||
}
|
||||
|
@ -1200,7 +1200,7 @@ update_static_array_size (struct type *type)
|
|||
struct type *range_type = type->index_type ();
|
||||
|
||||
if (type->dyn_prop (DYN_PROP_BYTE_STRIDE) == nullptr
|
||||
&& has_static_range (TYPE_RANGE_DATA (range_type))
|
||||
&& has_static_range (range_type->bounds ())
|
||||
&& (!type_not_associated (type)
|
||||
&& !type_not_allocated (type)))
|
||||
{
|
||||
|
@ -2017,7 +2017,7 @@ is_dynamic_type_internal (struct type *type, int top_level)
|
|||
dynamic when its subtype is dynamic, even if the bounds
|
||||
of the range type are static. It allows us to assume that
|
||||
the subtype of a static range type is also static. */
|
||||
return (!has_static_range (TYPE_RANGE_DATA (type))
|
||||
return (!has_static_range (type->bounds ())
|
||||
|| is_dynamic_type_internal (TYPE_TARGET_TYPE (type), 0));
|
||||
}
|
||||
|
||||
|
@ -2094,12 +2094,11 @@ resolve_dynamic_range (struct type *dyn_range_type,
|
|||
{
|
||||
CORE_ADDR value;
|
||||
struct type *static_range_type, *static_target_type;
|
||||
const struct dynamic_prop *prop;
|
||||
struct dynamic_prop low_bound, high_bound, stride;
|
||||
|
||||
gdb_assert (dyn_range_type->code () == TYPE_CODE_RANGE);
|
||||
|
||||
prop = &TYPE_RANGE_DATA (dyn_range_type)->low;
|
||||
const struct dynamic_prop *prop = &dyn_range_type->bounds ()->low;
|
||||
if (dwarf2_evaluate_property (prop, NULL, addr_stack, &value))
|
||||
{
|
||||
low_bound.kind = PROP_CONST;
|
||||
|
@ -2111,13 +2110,13 @@ resolve_dynamic_range (struct type *dyn_range_type,
|
|||
low_bound.data.const_val = 0;
|
||||
}
|
||||
|
||||
prop = &TYPE_RANGE_DATA (dyn_range_type)->high;
|
||||
prop = &dyn_range_type->bounds ()->high;
|
||||
if (dwarf2_evaluate_property (prop, NULL, addr_stack, &value))
|
||||
{
|
||||
high_bound.kind = PROP_CONST;
|
||||
high_bound.data.const_val = value;
|
||||
|
||||
if (TYPE_RANGE_DATA (dyn_range_type)->flag_upper_bound_is_count)
|
||||
if (dyn_range_type->bounds ()->flag_upper_bound_is_count)
|
||||
high_bound.data.const_val
|
||||
= low_bound.data.const_val + high_bound.data.const_val - 1;
|
||||
}
|
||||
|
@ -2127,8 +2126,8 @@ resolve_dynamic_range (struct type *dyn_range_type,
|
|||
high_bound.data.const_val = 0;
|
||||
}
|
||||
|
||||
bool byte_stride_p = TYPE_RANGE_DATA (dyn_range_type)->flag_is_byte_stride;
|
||||
prop = &TYPE_RANGE_DATA (dyn_range_type)->stride;
|
||||
bool byte_stride_p = dyn_range_type->bounds ()->flag_is_byte_stride;
|
||||
prop = &dyn_range_type->bounds ()->stride;
|
||||
if (dwarf2_evaluate_property (prop, NULL, addr_stack, &value))
|
||||
{
|
||||
stride.kind = PROP_CONST;
|
||||
|
@ -2154,11 +2153,11 @@ resolve_dynamic_range (struct type *dyn_range_type,
|
|||
static_target_type
|
||||
= resolve_dynamic_type_internal (TYPE_TARGET_TYPE (dyn_range_type),
|
||||
addr_stack, 0);
|
||||
LONGEST bias = TYPE_RANGE_DATA (dyn_range_type)->bias;
|
||||
LONGEST bias = dyn_range_type->bounds ()->bias;
|
||||
static_range_type = create_range_type_with_stride
|
||||
(copy_type (dyn_range_type), static_target_type,
|
||||
&low_bound, &high_bound, bias, &stride, byte_stride_p);
|
||||
TYPE_RANGE_DATA (static_range_type)->flag_bound_evaluated = 1;
|
||||
static_range_type->bounds ()->flag_bound_evaluated = 1;
|
||||
return static_range_type;
|
||||
}
|
||||
|
||||
|
@ -4036,7 +4035,7 @@ check_types_equal (struct type *type1, struct type *type2,
|
|||
|
||||
if (type1->code () == TYPE_CODE_RANGE)
|
||||
{
|
||||
if (*TYPE_RANGE_DATA (type1) != *TYPE_RANGE_DATA (type2))
|
||||
if (*type1->bounds () != *type2->bounds ())
|
||||
return false;
|
||||
}
|
||||
else
|
||||
|
|
|
@ -1518,22 +1518,21 @@ extern unsigned type_align (struct type *);
|
|||
space in struct type. */
|
||||
extern bool set_type_align (struct type *, ULONGEST);
|
||||
|
||||
#define TYPE_RANGE_DATA(thistype) ((thistype)->bounds ())
|
||||
#define TYPE_LOW_BOUND(range_type) \
|
||||
TYPE_RANGE_DATA(range_type)->low.data.const_val
|
||||
((range_type)->bounds ()->low.data.const_val)
|
||||
#define TYPE_HIGH_BOUND(range_type) \
|
||||
TYPE_RANGE_DATA(range_type)->high.data.const_val
|
||||
((range_type)->bounds ()->high.data.const_val)
|
||||
#define TYPE_LOW_BOUND_UNDEFINED(range_type) \
|
||||
(TYPE_RANGE_DATA(range_type)->low.kind == PROP_UNDEFINED)
|
||||
(TYPE_LOW_BOUND_KIND(range_type) == PROP_UNDEFINED)
|
||||
#define TYPE_HIGH_BOUND_UNDEFINED(range_type) \
|
||||
(TYPE_RANGE_DATA(range_type)->high.kind == PROP_UNDEFINED)
|
||||
(TYPE_HIGH_BOUND_KIND(range_type) == PROP_UNDEFINED)
|
||||
#define TYPE_HIGH_BOUND_KIND(range_type) \
|
||||
TYPE_RANGE_DATA(range_type)->high.kind
|
||||
((range_type)->bounds ()->high.kind)
|
||||
#define TYPE_LOW_BOUND_KIND(range_type) \
|
||||
TYPE_RANGE_DATA(range_type)->low.kind
|
||||
((range_type)->bounds ()->low.kind)
|
||||
#define TYPE_BIT_STRIDE(range_type) \
|
||||
(TYPE_RANGE_DATA(range_type)->stride.data.const_val \
|
||||
* (TYPE_RANGE_DATA(range_type)->flag_is_byte_stride ? 8 : 1))
|
||||
((range_type)->bounds ()->stride.data.const_val \
|
||||
* ((range_type)->bounds ()->flag_is_byte_stride ? 8 : 1))
|
||||
|
||||
/* Property accessors for the type data location. */
|
||||
#define TYPE_DATA_LOCATION(thistype) \
|
||||
|
|
|
@ -418,8 +418,7 @@ print_scalar_formatted (const gdb_byte *valaddr, struct type *type,
|
|||
|| options->format == 'z'
|
||||
|| options->format == 'd'
|
||||
|| options->format == 'u'))
|
||||
|| (type->code () == TYPE_CODE_RANGE
|
||||
&& TYPE_RANGE_DATA (type)->bias != 0))
|
||||
|| (type->code () == TYPE_CODE_RANGE && type->bounds ()->bias != 0))
|
||||
{
|
||||
val_long.emplace (unpack_long (type, valaddr));
|
||||
converted_bytes.resize (TYPE_LENGTH (type));
|
||||
|
|
|
@ -2781,7 +2781,7 @@ unpack_long (struct type *type, const gdb_byte *valaddr)
|
|||
else
|
||||
result = extract_signed_integer (valaddr, len, byte_order);
|
||||
if (code == TYPE_CODE_RANGE)
|
||||
result += TYPE_RANGE_DATA (type)->bias;
|
||||
result += type->bounds ()->bias;
|
||||
return result;
|
||||
}
|
||||
|
||||
|
@ -3331,7 +3331,7 @@ pack_long (gdb_byte *buf, struct type *type, LONGEST num)
|
|||
switch (type->code ())
|
||||
{
|
||||
case TYPE_CODE_RANGE:
|
||||
num -= TYPE_RANGE_DATA (type)->bias;
|
||||
num -= type->bounds ()->bias;
|
||||
/* Fall through. */
|
||||
case TYPE_CODE_INT:
|
||||
case TYPE_CODE_CHAR:
|
||||
|
|
Loading…
Add table
Reference in a new issue