aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--gdb/ChangeLog5
-rw-r--r--gdb/ada-lang.c2
-rw-r--r--gdb/compile/compile-c-symbols.c2
-rw-r--r--gdb/compile/compile-c-types.c2
-rw-r--r--gdb/compile/compile-cplus-types.c2
-rw-r--r--gdb/dwarf2/read.c2
-rw-r--r--gdb/eval.c2
-rw-r--r--gdb/gdbtypes.c25
-rw-r--r--gdb/gdbtypes.h17
-rw-r--r--gdb/printcmd.c3
-rw-r--r--gdb/value.c4
11 files changed, 34 insertions, 32 deletions
diff --git a/gdb/ChangeLog b/gdb/ChangeLog
index 09bcc67..90168a3 100644
--- a/gdb/ChangeLog
+++ b/gdb/ChangeLog
@@ -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.
diff --git a/gdb/ada-lang.c b/gdb/ada-lang.c
index cbcceba..88ab7dd 100644
--- a/gdb/ada-lang.c
+++ b/gdb/ada-lang.c
@@ -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;
}
}
diff --git a/gdb/compile/compile-c-symbols.c b/gdb/compile/compile-c-symbols.c
index 4ff757a..be2ca35 100644
--- a/gdb/compile/compile-c-symbols.c
+++ b/gdb/compile/compile-c-symbols.c
@@ -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 (),
diff --git a/gdb/compile/compile-c-types.c b/gdb/compile/compile-c-types.c
index aad3588..e5050da 100644
--- a/gdb/compile/compile-c-types.c
+++ b/gdb/compile/compile-c-types.c
@@ -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;
diff --git a/gdb/compile/compile-cplus-types.c b/gdb/compile/compile-cplus-types.c
index b04d6c6..d070360 100644
--- a/gdb/compile/compile-cplus-types.c
+++ b/gdb/compile/compile-cplus-types.c
@@ -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 ());
}
diff --git a/gdb/dwarf2/read.c b/gdb/dwarf2/read.c
index 405b5fb..bc8f4a1 100644
--- a/gdb/dwarf2/read.c
+++ b/gdb/dwarf2/read.c
@@ -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)
diff --git a/gdb/eval.c b/gdb/eval.c
index f975081..e28bfcb 100644
--- a/gdb/eval.c
+++ b/gdb/eval.c
@@ -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
diff --git a/gdb/gdbtypes.c b/gdb/gdbtypes.c
index 66f0943..957307e 100644
--- a/gdb/gdbtypes.c
+++ b/gdb/gdbtypes.c
@@ -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
diff --git a/gdb/gdbtypes.h b/gdb/gdbtypes.h
index 236d37b..2a1e693 100644
--- a/gdb/gdbtypes.h
+++ b/gdb/gdbtypes.h
@@ -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) \
diff --git a/gdb/printcmd.c b/gdb/printcmd.c
index 388a0b2..309d2ca 100644
--- a/gdb/printcmd.c
+++ b/gdb/printcmd.c
@@ -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));
diff --git a/gdb/value.c b/gdb/value.c
index 00d8ded..3a5b02b 100644
--- a/gdb/value.c
+++ b/gdb/value.c
@@ -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: