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
+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.
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;
}
}
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 (),
" 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;
}
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 ());
}
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)
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
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;
}
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)))
{
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));
}
{
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;
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;
}
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;
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;
}
if (type1->code () == TYPE_CODE_RANGE)
{
- if (*TYPE_RANGE_DATA (type1) != *TYPE_RANGE_DATA (type2))
+ if (*type1->bounds () != *type2->bounds ())
return false;
}
else
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) \
|| 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));
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;
}
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: