aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSimon Marchi <simon.marchi@efficios.com>2020-06-08 15:25:53 -0400
committerSimon Marchi <simon.marchi@efficios.com>2020-06-08 15:26:01 -0400
commit3d967001ecd3b325fc39d7f53ebf7054d1ecd503 (patch)
tree49d06d14ea849b5a58b207dc5e7e4303b3ae0b67
parent262abc0d67af006a709d0935940f9c9f5f7c5ee5 (diff)
downloadfsf-binutils-gdb-3d967001ecd3b325fc39d7f53ebf7054d1ecd503.zip
fsf-binutils-gdb-3d967001ecd3b325fc39d7f53ebf7054d1ecd503.tar.gz
fsf-binutils-gdb-3d967001ecd3b325fc39d7f53ebf7054d1ecd503.tar.bz2
gdb: remove TYPE_INDEX_TYPE macro
Remove `TYPE_INDEX_TYPE` macro, changing all the call sites to use `type::index_type` directly. gdb/ChangeLog: * gdbtypes.h (TYPE_INDEX_TYPE): Remove. Change all call sites to use type::index_type instead. Change-Id: I56715df0bdec89463cda6bd341dac0e01b2faf84
-rw-r--r--gdb/ChangeLog5
-rw-r--r--gdb/ada-lang.c24
-rw-r--r--gdb/ada-tasks.c2
-rw-r--r--gdb/ada-typeprint.c2
-rw-r--r--gdb/ada-valprint.c4
-rw-r--r--gdb/ada-varobj.c6
-rw-r--r--gdb/c-lang.c2
-rw-r--r--gdb/c-typeprint.c4
-rw-r--r--gdb/c-varobj.c6
-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/eval.c12
-rw-r--r--gdb/f-valprint.c2
-rw-r--r--gdb/gdbtypes.c12
-rw-r--r--gdb/gdbtypes.h11
-rw-r--r--gdb/guile/scm-type.c4
-rw-r--r--gdb/m2-typeprint.c22
-rw-r--r--gdb/m2-valprint.c11
-rw-r--r--gdb/p-typeprint.c2
-rw-r--r--gdb/p-valprint.c2
-rw-r--r--gdb/python/py-type.c4
-rw-r--r--gdb/rust-lang.c4
-rw-r--r--gdb/type-stack.c2
-rw-r--r--gdb/valarith.c4
-rw-r--r--gdb/valops.c4
-rw-r--r--gdb/valprint.c2
27 files changed, 81 insertions, 78 deletions
diff --git a/gdb/ChangeLog b/gdb/ChangeLog
index 6870b2c..38f9fad 100644
--- a/gdb/ChangeLog
+++ b/gdb/ChangeLog
@@ -1,5 +1,10 @@
2020-06-08 Simon Marchi <simon.marchi@efficios.com>
+ * gdbtypes.h (TYPE_INDEX_TYPE): Remove. Change all call sites
+ to use type::index_type instead.
+
+2020-06-08 Simon Marchi <simon.marchi@efficios.com>
+
* gdbtypes.h (struct type) <index_type, set_index_type>: New
methods.
(TYPE_INDEX_TYPE): Use type::index_type.
diff --git a/gdb/ada-lang.c b/gdb/ada-lang.c
index b1c689b..4f6c6b4 100644
--- a/gdb/ada-lang.c
+++ b/gdb/ada-lang.c
@@ -2081,7 +2081,7 @@ constrained_packed_array_type (struct type *type, long *elt_bits)
index_type = to_fixed_range_type (TYPE_FIELD_TYPE (index_type_desc, 0),
NULL);
else
- index_type = TYPE_INDEX_TYPE (type);
+ index_type = type->index_type ();
new_type = alloc_type_copy (type);
new_elt_type =
@@ -2235,7 +2235,7 @@ value_subscript_packed (struct value *arr, int arity, struct value **ind)
"something other than a packed array"));
else
{
- struct type *range_type = TYPE_INDEX_TYPE (elt_type);
+ struct type *range_type = elt_type->index_type ();
LONGEST lowerbound, upperbound;
LONGEST idx;
@@ -2730,7 +2730,7 @@ ada_value_ptr_subscript (struct value *arr, int arity, struct value **ind)
error (_("too many subscripts (%d expected)"), k);
arr = value_cast (lookup_pointer_type (TYPE_TARGET_TYPE (type)),
value_copy (arr));
- get_discrete_bounds (TYPE_INDEX_TYPE (type), &lwb, &upb);
+ get_discrete_bounds (type->index_type (), &lwb, &upb);
arr = value_ptradd (arr, pos_atr (ind[k]) - lwb);
type = TYPE_TARGET_TYPE (type);
}
@@ -2747,14 +2747,14 @@ ada_value_slice_from_ptr (struct value *array_ptr, struct type *type,
int low, int high)
{
struct type *type0 = ada_check_typedef (type);
- struct type *base_index_type = TYPE_TARGET_TYPE (TYPE_INDEX_TYPE (type0));
+ struct type *base_index_type = TYPE_TARGET_TYPE (type0->index_type ());
struct type *index_type
= create_static_range_type (NULL, base_index_type, low, high);
struct type *slice_type = create_array_type_with_stride
(NULL, TYPE_TARGET_TYPE (type0), index_type,
type0->dyn_prop (DYN_PROP_BYTE_STRIDE),
TYPE_FIELD_BITSIZE (type0, 0));
- int base_low = ada_discrete_type_low_bound (TYPE_INDEX_TYPE (type0));
+ int base_low = ada_discrete_type_low_bound (type0->index_type ());
LONGEST base_low_pos, low_pos;
CORE_ADDR base;
@@ -2777,9 +2777,9 @@ static struct value *
ada_value_slice (struct value *array, int low, int high)
{
struct type *type = ada_check_typedef (value_type (array));
- struct type *base_index_type = TYPE_TARGET_TYPE (TYPE_INDEX_TYPE (type));
+ struct type *base_index_type = TYPE_TARGET_TYPE (type->index_type ());
struct type *index_type
- = create_static_range_type (NULL, TYPE_INDEX_TYPE (type), low, high);
+ = create_static_range_type (NULL, type->index_type (), low, high);
struct type *slice_type = create_array_type_with_stride
(NULL, TYPE_TARGET_TYPE (type), index_type,
type->dyn_prop (DYN_PROP_BYTE_STRIDE),
@@ -2892,7 +2892,7 @@ ada_index_type (struct type *type, int n, const char *name)
for (i = 1; i < n; i += 1)
type = TYPE_TARGET_TYPE (type);
- result_type = TYPE_TARGET_TYPE (TYPE_INDEX_TYPE (type));
+ result_type = TYPE_TARGET_TYPE (type->index_type ());
/* FIXME: The stabs type r(0,0);bound;bound in an array type
has a target type of TYPE_CODE_UNDEF. We compensate here, but
perhaps stabsread.c would make more sense. */
@@ -2957,7 +2957,7 @@ ada_array_bound_from_type (struct type *arr_type, int n, int which)
for (i = 1; i < n; i++)
elt_type = check_typedef (TYPE_TARGET_TYPE (elt_type));
- index_type = TYPE_INDEX_TYPE (elt_type);
+ index_type = elt_type->index_type ();
}
return
@@ -3044,7 +3044,7 @@ empty_array (struct type *arr_type, int low, int high)
struct type *arr_type0 = ada_check_typedef (arr_type);
struct type *index_type
= create_static_range_type
- (NULL, TYPE_TARGET_TYPE (TYPE_INDEX_TYPE (arr_type0)), low,
+ (NULL, TYPE_TARGET_TYPE (arr_type0->index_type ()), low,
high < low ? low - 1 : high);
struct type *elt_type = ada_array_element_type (arr_type0, 1);
@@ -8522,7 +8522,7 @@ ada_is_redundant_index_type_desc (struct type *array_type,
for (i = 0; i < desc_type->num_fields (); i++)
{
- if (!ada_is_redundant_range_encoding (TYPE_INDEX_TYPE (this_layer),
+ if (!ada_is_redundant_range_encoding (this_layer->index_type (),
TYPE_FIELD_TYPE (desc_type, i)))
return 0;
this_layer = check_typedef (TYPE_TARGET_TYPE (this_layer));
@@ -8616,7 +8616,7 @@ to_fixed_array_type (struct type *type0, struct value *dval,
result = type0;
else
result = create_array_type (alloc_type_copy (type0),
- elt_type, TYPE_INDEX_TYPE (type0));
+ elt_type, type0->index_type ());
}
else
{
diff --git a/gdb/ada-tasks.c b/gdb/ada-tasks.c
index 1288e16..dfabac3 100644
--- a/gdb/ada-tasks.c
+++ b/gdb/ada-tasks.c
@@ -894,7 +894,7 @@ ada_tasks_inferior_data_sniffer (struct ada_tasks_inferior_data *data)
eltype = check_typedef (TYPE_TARGET_TYPE (type));
if (eltype != NULL
&& eltype->code () == TYPE_CODE_PTR)
- idxtype = check_typedef (TYPE_INDEX_TYPE (type));
+ idxtype = check_typedef (type->index_type ());
if (idxtype != NULL
&& !TYPE_LOW_BOUND_UNDEFINED (idxtype)
&& !TYPE_HIGH_BOUND_UNDEFINED (idxtype))
diff --git a/gdb/ada-typeprint.c b/gdb/ada-typeprint.c
index 2021edf..c6056a3 100644
--- a/gdb/ada-typeprint.c
+++ b/gdb/ada-typeprint.c
@@ -407,7 +407,7 @@ print_array_type (struct type *type, struct ui_file *stream, int show,
{
if (arr_type != type)
fprintf_filtered (stream, ", ");
- print_range (TYPE_INDEX_TYPE (arr_type), stream,
+ print_range (arr_type->index_type (), stream,
0 /* bounds_prefered_p */);
if (TYPE_FIELD_BITSIZE (arr_type, 0) > 0)
bitsize = TYPE_FIELD_BITSIZE (arr_type, 0);
diff --git a/gdb/ada-valprint.c b/gdb/ada-valprint.c
index c637e78..d295e55 100644
--- a/gdb/ada-valprint.c
+++ b/gdb/ada-valprint.c
@@ -71,7 +71,7 @@ print_optional_low_bound (struct ui_file *stream, struct type *type,
if (low_bound > high_bound)
return 0;
- index_type = TYPE_INDEX_TYPE (type);
+ index_type = type->index_type ();
while (index_type->code () == TYPE_CODE_RANGE)
{
@@ -131,7 +131,7 @@ val_print_packed_array_elements (struct type *type, const gdb_byte *valaddr,
LONGEST low = 0;
elttype = TYPE_TARGET_TYPE (type);
- index_type = TYPE_INDEX_TYPE (type);
+ index_type = type->index_type ();
{
LONGEST high;
diff --git a/gdb/ada-varobj.c b/gdb/ada-varobj.c
index 485eae2..d28beff 100644
--- a/gdb/ada-varobj.c
+++ b/gdb/ada-varobj.c
@@ -178,7 +178,7 @@ ada_varobj_simple_array_elt (struct value *parent_value,
if (parent_value)
{
struct value *index_value =
- value_from_longest (TYPE_INDEX_TYPE (parent_type), elt_index);
+ value_from_longest (parent_type->index_type (), elt_index);
value = ada_value_subscript (parent_value, 1, &index_value);
type = value_type (value);
@@ -234,7 +234,7 @@ ada_varobj_get_array_number_of_children (struct value *parent_value,
LONGEST lo, hi;
if (parent_value == NULL
- && is_dynamic_type (TYPE_INDEX_TYPE (parent_type)))
+ && is_dynamic_type (parent_type->index_type ()))
{
/* This happens when listing the children of an object
which does not exist in memory (Eg: when requesting
@@ -589,7 +589,7 @@ ada_varobj_describe_simple_array_child (struct value *parent_value,
gdb_assert (parent_type->code () == TYPE_CODE_ARRAY);
- index_type = TYPE_INDEX_TYPE (parent_type);
+ index_type = parent_type->index_type ();
real_index = child_index + ada_discrete_type_low_bound (index_type);
if (child_name)
diff --git a/gdb/c-lang.c b/gdb/c-lang.c
index 364a672..8eb0d94 100644
--- a/gdb/c-lang.c
+++ b/gdb/c-lang.c
@@ -698,7 +698,7 @@ evaluate_subexp_c (struct type *expect_type, struct expression *exp,
LONGEST low_bound, high_bound;
int element_size = TYPE_LENGTH (type);
- if (get_discrete_bounds (TYPE_INDEX_TYPE (expect_type),
+ if (get_discrete_bounds (expect_type->index_type (),
&low_bound, &high_bound) < 0)
{
low_bound = 0;
diff --git a/gdb/c-typeprint.c b/gdb/c-typeprint.c
index 8ed6c06..35cfd21 100644
--- a/gdb/c-typeprint.c
+++ b/gdb/c-typeprint.c
@@ -780,8 +780,8 @@ c_type_print_varspec_suffix (struct type *type,
fprintf_filtered (stream, (is_vector ?
" __attribute__ ((vector_size(" : "["));
/* Bounds are not yet resolved, print a bounds placeholder instead. */
- if (TYPE_HIGH_BOUND_KIND (TYPE_INDEX_TYPE (type)) == PROP_LOCEXPR
- || TYPE_HIGH_BOUND_KIND (TYPE_INDEX_TYPE (type)) == PROP_LOCLIST)
+ if (TYPE_HIGH_BOUND_KIND (type->index_type ()) == PROP_LOCEXPR
+ || TYPE_HIGH_BOUND_KIND (type->index_type ()) == PROP_LOCLIST)
fprintf_filtered (stream, "variable length");
else if (get_array_bounds (type, &low_bound, &high_bound))
fprintf_filtered (stream, "%s",
diff --git a/gdb/c-varobj.c b/gdb/c-varobj.c
index 2be447a..362fd79 100644
--- a/gdb/c-varobj.c
+++ b/gdb/c-varobj.c
@@ -307,12 +307,12 @@ c_describe_child (const struct varobj *parent, int index,
case TYPE_CODE_ARRAY:
if (cname)
*cname = int_string (index
- + TYPE_LOW_BOUND (TYPE_INDEX_TYPE (type)),
+ + TYPE_LOW_BOUND (type->index_type ()),
10, 1, 0, 0);
if (cvalue && value)
{
- int real_index = index + TYPE_LOW_BOUND (TYPE_INDEX_TYPE (type));
+ int real_index = index + TYPE_LOW_BOUND (type->index_type ());
try
{
@@ -330,7 +330,7 @@ c_describe_child (const struct varobj *parent, int index,
*cfull_expression =
string_printf ("(%s)[%s]", parent_expression.c_str (),
int_string (index
- + TYPE_LOW_BOUND (TYPE_INDEX_TYPE (type)),
+ + TYPE_LOW_BOUND (type->index_type ()),
10, 1, 0, 0));
diff --git a/gdb/compile/compile-c-symbols.c b/gdb/compile/compile-c-symbols.c
index 758b12d..84148fa 100644
--- a/gdb/compile/compile-c-symbols.c
+++ b/gdb/compile/compile-c-symbols.c
@@ -516,7 +516,7 @@ generate_vla_size (compile_instance *compiler,
case TYPE_CODE_ARRAY:
generate_vla_size (compiler, stream, gdbarch, registers_used, pc,
- TYPE_INDEX_TYPE (type), sym);
+ type->index_type (), sym);
generate_vla_size (compiler, stream, gdbarch, registers_used, pc,
TYPE_TARGET_TYPE (type), sym);
break;
diff --git a/gdb/compile/compile-c-types.c b/gdb/compile/compile-c-types.c
index c4f5811..3cf89fd 100644
--- a/gdb/compile/compile-c-types.c
+++ b/gdb/compile/compile-c-types.c
@@ -40,7 +40,7 @@ static gcc_type
convert_array (compile_c_instance *context, struct type *type)
{
gcc_type element_type;
- struct type *range = TYPE_INDEX_TYPE (type);
+ struct type *range = type->index_type ();
element_type = context->convert_type (TYPE_TARGET_TYPE (type));
diff --git a/gdb/compile/compile-cplus-types.c b/gdb/compile/compile-cplus-types.c
index eb70dfe..20d84a5 100644
--- a/gdb/compile/compile-cplus-types.c
+++ b/gdb/compile/compile-cplus-types.c
@@ -453,7 +453,7 @@ static gcc_type
compile_cplus_convert_array (compile_cplus_instance *instance,
struct type *type)
{
- struct type *range = TYPE_INDEX_TYPE (type);
+ struct type *range = type->index_type ();
gcc_type element_type = instance->convert_type (TYPE_TARGET_TYPE (type));
if (TYPE_LOW_BOUND_KIND (range) != PROP_CONST)
diff --git a/gdb/eval.c b/gdb/eval.c
index 20533ab..6759d22 100644
--- a/gdb/eval.c
+++ b/gdb/eval.c
@@ -377,7 +377,7 @@ value_f90_subarray (struct value *array,
{
int pc = (*pos) + 1;
LONGEST low_bound, high_bound;
- struct type *range = check_typedef (TYPE_INDEX_TYPE (value_type (array)));
+ struct type *range = check_typedef (value_type (array)->index_type ());
enum range_type range_type
= (enum range_type) longest_to_int (exp->elts[pc].longconst);
@@ -1459,7 +1459,7 @@ evaluate_subexp_standard (struct type *expect_type,
if (expect_type != NULL_TYPE && noside != EVAL_SKIP
&& type->code () == TYPE_CODE_ARRAY)
{
- struct type *range_type = TYPE_INDEX_TYPE (type);
+ struct type *range_type = type->index_type ();
struct type *element_type = TYPE_TARGET_TYPE (type);
struct value *array = allocate_value (expect_type);
int element_size = TYPE_LENGTH (check_typedef (element_type));
@@ -1509,7 +1509,7 @@ evaluate_subexp_standard (struct type *expect_type,
{
struct value *set = allocate_value (expect_type);
gdb_byte *valaddr = value_contents_raw (set);
- struct type *element_type = TYPE_INDEX_TYPE (type);
+ struct type *element_type = type->index_type ();
struct type *check_type = element_type;
LONGEST low_bound, high_bound;
@@ -3212,8 +3212,8 @@ evaluate_subexp_for_sizeof (struct expression *exp, int *pos,
val = evaluate_subexp (NULL_TYPE, exp, pos, EVAL_NORMAL);
type = value_type (val);
if (type->code () == TYPE_CODE_ARRAY
- && is_dynamic_type (TYPE_INDEX_TYPE (type))
- && TYPE_HIGH_BOUND_UNDEFINED (TYPE_INDEX_TYPE (type)))
+ && is_dynamic_type (type->index_type ())
+ && TYPE_HIGH_BOUND_UNDEFINED (type->index_type ()))
return allocate_optimized_out_value (size_type);
}
else
@@ -3253,7 +3253,7 @@ evaluate_subexp_for_sizeof (struct expression *exp, int *pos,
type = check_typedef (TYPE_TARGET_TYPE (type));
if (type->code () == TYPE_CODE_ARRAY)
{
- type = TYPE_INDEX_TYPE (type);
+ 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)
diff --git a/gdb/f-valprint.c b/gdb/f-valprint.c
index bd16a43..26646b3 100644
--- a/gdb/f-valprint.c
+++ b/gdb/f-valprint.c
@@ -112,7 +112,7 @@ f77_print_array_1 (int nss, int ndimensions, struct type *type,
const struct value_print_options *options,
int *elts)
{
- struct type *range_type = TYPE_INDEX_TYPE (check_typedef (type));
+ struct type *range_type = check_typedef (type)->index_type ();
CORE_ADDR addr = address + embedded_offset;
LONGEST lowerbound, upperbound;
LONGEST i;
diff --git a/gdb/gdbtypes.c b/gdb/gdbtypes.c
index 67fd3d2..b2afb18 100644
--- a/gdb/gdbtypes.c
+++ b/gdb/gdbtypes.c
@@ -1117,7 +1117,7 @@ get_discrete_bounds (struct type *type, LONGEST *lowp, LONGEST *highp)
int
get_array_bounds (struct type *type, LONGEST *low_bound, LONGEST *high_bound)
{
- struct type *index = TYPE_INDEX_TYPE (type);
+ struct type *index = type->index_type ();
LONGEST low = 0;
LONGEST high = 0;
int res;
@@ -1195,7 +1195,7 @@ update_static_array_size (struct type *type)
{
gdb_assert (type->code () == TYPE_CODE_ARRAY);
- struct type *range_type = TYPE_INDEX_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))
@@ -2027,7 +2027,7 @@ is_dynamic_type_internal (struct type *type, int top_level)
gdb_assert (type->num_fields () == 1);
/* The array is dynamic if either the bounds are dynamic... */
- if (is_dynamic_type_internal (TYPE_INDEX_TYPE (type), 0))
+ if (is_dynamic_type_internal (type->index_type (), 0))
return 1;
/* ... or the elements it contains have a dynamic contents... */
if (is_dynamic_type_internal (TYPE_TARGET_TYPE (type), 0))
@@ -2183,7 +2183,7 @@ resolve_dynamic_array_or_string (struct type *type,
type = copy_type (type);
elt_type = type;
- range_type = check_typedef (TYPE_INDEX_TYPE (elt_type));
+ range_type = check_typedef (elt_type->index_type ());
range_type = resolve_dynamic_range (range_type, addr_stack);
/* Resolve allocated/associated here before creating a new array type, which
@@ -3541,12 +3541,12 @@ is_scalar_type_recursive (struct type *t)
/* Are we dealing with an array or string of known dimensions? */
else if ((t->code () == TYPE_CODE_ARRAY
|| t->code () == TYPE_CODE_STRING) && t->num_fields () == 1
- && TYPE_INDEX_TYPE(t)->code () == TYPE_CODE_RANGE)
+ && t->index_type ()->code () == TYPE_CODE_RANGE)
{
LONGEST low_bound, high_bound;
struct type *elt_type = check_typedef (TYPE_TARGET_TYPE (t));
- get_discrete_bounds (TYPE_INDEX_TYPE (t), &low_bound, &high_bound);
+ get_discrete_bounds (t->index_type (), &low_bound, &high_bound);
return high_bound == low_bound && is_scalar_type_recursive (elt_type);
}
diff --git a/gdb/gdbtypes.h b/gdb/gdbtypes.h
index 0cca0fd..ffb8a61 100644
--- a/gdb/gdbtypes.h
+++ b/gdb/gdbtypes.h
@@ -1492,7 +1492,6 @@ extern unsigned type_align (struct type *);
space in struct type. */
extern bool set_type_align (struct type *, ULONGEST);
-#define TYPE_INDEX_TYPE(type) ((type)->index_type ())
#define TYPE_RANGE_DATA(thistype) TYPE_MAIN_TYPE(thistype)->flds_bnds.bounds
#define TYPE_LOW_BOUND(range_type) \
TYPE_RANGE_DATA(range_type)->low.data.const_val
@@ -1541,18 +1540,18 @@ extern bool set_type_align (struct type *, ULONGEST);
index type. */
#define TYPE_ARRAY_UPPER_BOUND_IS_UNDEFINED(arraytype) \
- TYPE_HIGH_BOUND_UNDEFINED(TYPE_INDEX_TYPE(arraytype))
+ TYPE_HIGH_BOUND_UNDEFINED((arraytype)->index_type ())
#define TYPE_ARRAY_LOWER_BOUND_IS_UNDEFINED(arraytype) \
- TYPE_LOW_BOUND_UNDEFINED(TYPE_INDEX_TYPE(arraytype))
+ TYPE_LOW_BOUND_UNDEFINED((arraytype)->index_type ())
#define TYPE_ARRAY_UPPER_BOUND_VALUE(arraytype) \
- (TYPE_HIGH_BOUND(TYPE_INDEX_TYPE((arraytype))))
+ (TYPE_HIGH_BOUND((arraytype)->index_type ()))
#define TYPE_ARRAY_LOWER_BOUND_VALUE(arraytype) \
- (TYPE_LOW_BOUND(TYPE_INDEX_TYPE((arraytype))))
+ (TYPE_LOW_BOUND((arraytype)->index_type ()))
#define TYPE_ARRAY_BIT_STRIDE(arraytype) \
- (TYPE_BIT_STRIDE(TYPE_INDEX_TYPE((arraytype))))
+ (TYPE_BIT_STRIDE(((arraytype)->index_type ())))
/* C++ */
diff --git a/gdb/guile/scm-type.c b/gdb/guile/scm-type.c
index 6c0c3fd..a6a6b77 100644
--- a/gdb/guile/scm-type.c
+++ b/gdb/guile/scm-type.c
@@ -826,8 +826,8 @@ gdbscm_type_range (SCM self)
{
case TYPE_CODE_ARRAY:
case TYPE_CODE_STRING:
- low = TYPE_LOW_BOUND (TYPE_INDEX_TYPE (type));
- high = TYPE_HIGH_BOUND (TYPE_INDEX_TYPE (type));
+ low = TYPE_LOW_BOUND (type->index_type ());
+ high = TYPE_HIGH_BOUND (type->index_type ());
break;
case TYPE_CODE_RANGE:
low = TYPE_LOW_BOUND (type);
diff --git a/gdb/m2-typeprint.c b/gdb/m2-typeprint.c
index d2596b2..6b878ab 100644
--- a/gdb/m2-typeprint.c
+++ b/gdb/m2-typeprint.c
@@ -228,11 +228,11 @@ static void m2_array (struct type *type, struct ui_file *stream,
if (TYPE_LENGTH (TYPE_TARGET_TYPE (type)) > 0
&& !TYPE_ARRAY_UPPER_BOUND_IS_UNDEFINED (type))
{
- if (TYPE_INDEX_TYPE (type) != 0)
+ if (type->index_type () != 0)
{
- m2_print_bounds (TYPE_INDEX_TYPE (type), stream, show, -1, 0);
+ m2_print_bounds (type->index_type (), stream, show, -1, 0);
fprintf_filtered (stream, "..");
- m2_print_bounds (TYPE_INDEX_TYPE (type), stream, show, -1, 1);
+ m2_print_bounds (type->index_type (), stream, show, -1, 1);
}
else
fputs_filtered (pulongest ((TYPE_LENGTH (type)
@@ -324,11 +324,11 @@ static void
m2_short_set (struct type *type, struct ui_file *stream, int show, int level)
{
fprintf_filtered(stream, "SET [");
- m2_print_bounds (TYPE_INDEX_TYPE (type), stream,
+ m2_print_bounds (type->index_type (), stream,
show - 1, level, 0);
fprintf_filtered(stream, "..");
- m2_print_bounds (TYPE_INDEX_TYPE (type), stream,
+ m2_print_bounds (type->index_type (), stream,
show - 1, level, 1);
fprintf_filtered(stream, "]");
}
@@ -356,7 +356,7 @@ m2_is_long_set (struct type *type)
if (TYPE_FIELD_NAME (type, i) != NULL
&& (strcmp (TYPE_FIELD_NAME (type, i), "") != 0))
return 0;
- range = TYPE_INDEX_TYPE (TYPE_FIELD_TYPE (type, i));
+ range = TYPE_FIELD_TYPE (type, i)->index_type ();
if ((i > TYPE_N_BASECLASSES (type))
&& previous_high + 1 != TYPE_LOW_BOUND (range))
return 0;
@@ -413,11 +413,11 @@ m2_is_long_set_of_type (struct type *type, struct type **of_type)
i = TYPE_N_BASECLASSES (type);
if (len == 0)
return 0;
- range = TYPE_INDEX_TYPE (TYPE_FIELD_TYPE (type, i));
+ range = TYPE_FIELD_TYPE (type, i)->index_type ();
target = TYPE_TARGET_TYPE (range);
- l1 = TYPE_LOW_BOUND (TYPE_INDEX_TYPE (TYPE_FIELD_TYPE (type, i)));
- h1 = TYPE_HIGH_BOUND (TYPE_INDEX_TYPE (TYPE_FIELD_TYPE (type, len-1)));
+ l1 = TYPE_LOW_BOUND (TYPE_FIELD_TYPE (type, i)->index_type ());
+ h1 = TYPE_HIGH_BOUND (TYPE_FIELD_TYPE (type, len - 1)->index_type ());
*of_type = target;
if (m2_get_discrete_bounds (target, &l2, &h2) >= 0)
return (l1 == l2 && h1 == h2);
@@ -457,12 +457,12 @@ m2_long_set (struct type *type, struct ui_file *stream, int show, int level,
else
{
fprintf_filtered(stream, "[");
- m2_print_bounds (TYPE_INDEX_TYPE (TYPE_FIELD_TYPE (type, i)),
+ m2_print_bounds (TYPE_FIELD_TYPE (type, i)->index_type (),
stream, show - 1, level, 0);
fprintf_filtered(stream, "..");
- m2_print_bounds (TYPE_INDEX_TYPE (TYPE_FIELD_TYPE (type, len-1)),
+ m2_print_bounds (TYPE_FIELD_TYPE (type, len - 1)->index_type (),
stream, show - 1, level, 1);
fprintf_filtered(stream, "]");
}
diff --git a/gdb/m2-valprint.c b/gdb/m2-valprint.c
index f9cb626..214466b 100644
--- a/gdb/m2-valprint.c
+++ b/gdb/m2-valprint.c
@@ -55,9 +55,8 @@ get_long_set_bounds (struct type *type, LONGEST *low, LONGEST *high)
i = TYPE_N_BASECLASSES (type);
if (len == 0)
return 0;
- *low = TYPE_LOW_BOUND (TYPE_INDEX_TYPE (TYPE_FIELD_TYPE (type, i)));
- *high = TYPE_HIGH_BOUND (TYPE_INDEX_TYPE (TYPE_FIELD_TYPE (type,
- len-1)));
+ *low = TYPE_LOW_BOUND (TYPE_FIELD_TYPE (type, i)->index_type ());
+ *high = TYPE_HIGH_BOUND (TYPE_FIELD_TYPE (type, len - 1)->index_type ());
return 1;
}
error (_("expecting long_set"));
@@ -87,7 +86,7 @@ m2_print_long_set (struct type *type, const gdb_byte *valaddr,
if (get_long_set_bounds (type, &low_bound, &high_bound))
{
field = TYPE_N_BASECLASSES (type);
- range = TYPE_INDEX_TYPE (TYPE_FIELD_TYPE (type, field));
+ range = TYPE_FIELD_TYPE (type, field)->index_type ();
}
else
{
@@ -137,7 +136,7 @@ m2_print_long_set (struct type *type, const gdb_byte *valaddr,
field++;
if (field == len)
break;
- range = TYPE_INDEX_TYPE (TYPE_FIELD_TYPE (type, field));
+ range = TYPE_FIELD_TYPE (type, field)->index_type ();
if (get_discrete_bounds (range, &field_low, &field_high) < 0)
break;
target = TYPE_TARGET_TYPE (range);
@@ -382,7 +381,7 @@ m2_value_print_inner (struct value *val, struct ui_file *stream, int recurse,
break;
case TYPE_CODE_SET:
- elttype = TYPE_INDEX_TYPE (type);
+ elttype = type->index_type ();
elttype = check_typedef (elttype);
if (TYPE_STUB (elttype))
{
diff --git a/gdb/p-typeprint.c b/gdb/p-typeprint.c
index 70a8308..edde01b 100644
--- a/gdb/p-typeprint.c
+++ b/gdb/p-typeprint.c
@@ -805,7 +805,7 @@ pascal_type_print_base (struct type *type, struct ui_file *stream, int show,
case TYPE_CODE_SET:
fputs_filtered ("set of ", stream);
- pascal_print_type (TYPE_INDEX_TYPE (type), "", stream,
+ pascal_print_type (type->index_type (), "", stream,
show - 1, level, flags);
break;
diff --git a/gdb/p-valprint.c b/gdb/p-valprint.c
index cf902ac..064e819 100644
--- a/gdb/p-valprint.c
+++ b/gdb/p-valprint.c
@@ -330,7 +330,7 @@ pascal_value_print_inner (struct value *val, struct ui_file *stream,
break;
case TYPE_CODE_SET:
- elttype = TYPE_INDEX_TYPE (type);
+ elttype = type->index_type ();
elttype = check_typedef (elttype);
if (TYPE_STUB (elttype))
{
diff --git a/gdb/python/py-type.c b/gdb/python/py-type.c
index 7862f70..b871a6d 100644
--- a/gdb/python/py-type.c
+++ b/gdb/python/py-type.c
@@ -592,8 +592,8 @@ typy_range (PyObject *self, PyObject *args)
{
case TYPE_CODE_ARRAY:
case TYPE_CODE_STRING:
- low = TYPE_LOW_BOUND (TYPE_INDEX_TYPE (type));
- high = TYPE_HIGH_BOUND (TYPE_INDEX_TYPE (type));
+ low = TYPE_LOW_BOUND (type->index_type ());
+ high = TYPE_HIGH_BOUND (type->index_type ());
break;
case TYPE_CODE_RANGE:
low = TYPE_LOW_BOUND (type);
diff --git a/gdb/rust-lang.c b/gdb/rust-lang.c
index 0929daf..7fe6d3d 100644
--- a/gdb/rust-lang.c
+++ b/gdb/rust-lang.c
@@ -882,8 +882,8 @@ rust_internal_print_type (struct type *type, const char *varstring,
stream, show - 1, level, flags, false,
podata);
- if (TYPE_HIGH_BOUND_KIND (TYPE_INDEX_TYPE (type)) == PROP_LOCEXPR
- || TYPE_HIGH_BOUND_KIND (TYPE_INDEX_TYPE (type)) == PROP_LOCLIST)
+ if (TYPE_HIGH_BOUND_KIND (type->index_type ()) == PROP_LOCEXPR
+ || TYPE_HIGH_BOUND_KIND (type->index_type ()) == PROP_LOCLIST)
fprintf_filtered (stream, "; variable length");
else if (get_array_bounds (type, &low_bound, &high_bound))
fprintf_filtered (stream, "; %s",
diff --git a/gdb/type-stack.c b/gdb/type-stack.c
index 73b7d5a..2d5c88f 100644
--- a/gdb/type-stack.c
+++ b/gdb/type-stack.c
@@ -172,7 +172,7 @@ type_stack::follow_types (struct type *follow_type)
lookup_array_range_type (follow_type,
0, array_size >= 0 ? array_size - 1 : 0);
if (array_size < 0)
- TYPE_HIGH_BOUND_KIND (TYPE_INDEX_TYPE (follow_type))
+ TYPE_HIGH_BOUND_KIND (follow_type->index_type ())
= PROP_UNDEFINED;
break;
case tp_function:
diff --git a/gdb/valarith.c b/gdb/valarith.c
index 82e63a3..a5779a3 100644
--- a/gdb/valarith.c
+++ b/gdb/valarith.c
@@ -149,7 +149,7 @@ value_subscript (struct value *array, LONGEST index)
if (tarray->code () == TYPE_CODE_ARRAY
|| tarray->code () == TYPE_CODE_STRING)
{
- struct type *range_type = TYPE_INDEX_TYPE (tarray);
+ struct type *range_type = tarray->index_type ();
LONGEST lowerbound, upperbound;
get_discrete_bounds (range_type, &lowerbound, &upperbound);
@@ -1870,7 +1870,7 @@ value_bit_index (struct type *type, const gdb_byte *valaddr, int index)
LONGEST low_bound, high_bound;
LONGEST word;
unsigned rel_index;
- struct type *range = TYPE_INDEX_TYPE (type);
+ struct type *range = type->index_type ();
if (get_discrete_bounds (range, &low_bound, &high_bound) < 0)
return -2;
diff --git a/gdb/valops.c b/gdb/valops.c
index bde4684..2bc58ca 100644
--- a/gdb/valops.c
+++ b/gdb/valops.c
@@ -390,7 +390,7 @@ value_cast (struct type *type, struct value *arg2)
if (element_length > 0 && TYPE_ARRAY_UPPER_BOUND_IS_UNDEFINED (type))
{
- struct type *range_type = TYPE_INDEX_TYPE (type);
+ struct type *range_type = type->index_type ();
int val_length = TYPE_LENGTH (type2);
LONGEST low_bound, high_bound, new_length;
@@ -3769,7 +3769,7 @@ value_slice (struct value *array, int lowbound, int length)
if (type_not_associated (array_type))
error (_("array not associated"));
- range_type = TYPE_INDEX_TYPE (array_type);
+ range_type = array_type->index_type ();
if (get_discrete_bounds (range_type, &lowerbound, &upperbound) < 0)
error (_("slice from bad array or bitstring"));
diff --git a/gdb/valprint.c b/gdb/valprint.c
index ca7dab6..7051fce 100644
--- a/gdb/valprint.c
+++ b/gdb/valprint.c
@@ -1875,7 +1875,7 @@ value_print_array_elements (struct value *val, struct ui_file *stream,
elttype = TYPE_TARGET_TYPE (type);
eltlen = type_length_units (check_typedef (elttype));
- index_type = TYPE_INDEX_TYPE (type);
+ index_type = type->index_type ();
if (index_type->code () == TYPE_CODE_RANGE)
index_type = TYPE_TARGET_TYPE (index_type);