]> git.ipfire.org Git - thirdparty/binutils-gdb.git/commitdiff
gdb: remove TYPE_INDEX_TYPE macro
authorSimon Marchi <simon.marchi@efficios.com>
Mon, 8 Jun 2020 19:25:53 +0000 (15:25 -0400)
committerSimon Marchi <simon.marchi@efficios.com>
Mon, 8 Jun 2020 19:26:01 +0000 (15:26 -0400)
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

27 files changed:
gdb/ChangeLog
gdb/ada-lang.c
gdb/ada-tasks.c
gdb/ada-typeprint.c
gdb/ada-valprint.c
gdb/ada-varobj.c
gdb/c-lang.c
gdb/c-typeprint.c
gdb/c-varobj.c
gdb/compile/compile-c-symbols.c
gdb/compile/compile-c-types.c
gdb/compile/compile-cplus-types.c
gdb/eval.c
gdb/f-valprint.c
gdb/gdbtypes.c
gdb/gdbtypes.h
gdb/guile/scm-type.c
gdb/m2-typeprint.c
gdb/m2-valprint.c
gdb/p-typeprint.c
gdb/p-valprint.c
gdb/python/py-type.c
gdb/rust-lang.c
gdb/type-stack.c
gdb/valarith.c
gdb/valops.c
gdb/valprint.c

index 6870b2ca5bf6d18ff615021caf61d15a99649d45..38f9fadf5f9546937ed223d623e9adc37d2d98c1 100644 (file)
@@ -1,3 +1,8 @@
+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
index b1c689beb0fe307799cbfc20f73f1ae3ca495090..4f6c6b465aea3d69a6136966384b4fbd5df0a1bc 100644 (file)
@@ -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
     {
index 1288e1608f57f7377d49b86b5ced72a91a41cef7..dfabac3767427d737a8869c773781396eca7d526 100644 (file)
@@ -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))
index 2021edf011182e2b587126ac305105d81d66ed86..c6056a32106553eff03d3a4fba87db455e260da9 100644 (file)
@@ -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);
index c637e7826fe35a21e3fc86512676f599038f8f45..d295e55aec646f0c62d2fd1c4ceb91fbd00dee37 100644 (file)
@@ -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;
index 485eae29b92573ce0d6bfc5adcf58be6bb793b76..d28beffc9619ad0c4a089a838d891725f3a607f0 100644 (file)
@@ -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)
index 364a672119aec2d8404ab58a39e419b06e376f3c..8eb0d944a75f81ed2886f1290f1b28e430366469 100644 (file)
@@ -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;
index 8ed6c06781117caea9d20b12539843db010213a5..35cfd219edcae6f723d2aa8f01af9a6bcf6568aa 100644 (file)
@@ -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", 
index 2be447a86609a1a82eeb743fd16b317907bab564..362fd79c89b4fa0a4064f8ed53b97a6eae798cae 100644 (file)
@@ -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));
 
 
index 758b12db1a784370b38bd48b0cdc3b6943405f48..84148fad895ef6e270210956669cc7a782631304 100644 (file)
@@ -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;
index c4f5811678eb5dddf0b4b49a6907cf05d830f976..3cf89fddffcc200d978d8e4238bc2dd845cd1831 100644 (file)
@@ -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));
 
index eb70dfe967a44747e936033d32070e92bfad01db..20d84a549653d33e6ee743481646ecc1238b3e6e 100644 (file)
@@ -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)
index 20533abf93d0f72aa5100e711d06e1b5f8fedf6b..6759d228fc89daf7c4303ae6a11eb955bc2a0e50 100644 (file)
@@ -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)
index bd16a4348d34269819f8d7f3bcf1afcdfda322e0..26646b32ac8553b1501d0b1aee918b13a99e53de 100644 (file)
@@ -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;
index 67fd3d20a8f02ae0baf554d54ff4828eeb31e804..b2afb186beb42ab9f03ba52e488fbbc1b1b0ef9d 100644 (file)
@@ -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);
     }
index 0cca0fdbd1d095eb404ba906f14073a12709f029..ffb8a616cfbb1eee14751020ceaffad8da10c58b 100644 (file)
@@ -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++ */
 
index 6c0c3fd3617c750c1ac2025d3c5d7f8b9a7d03be..a6a6b77f868ab0ddc29b2773cfa75db8356f53f2 100644 (file)
@@ -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);
index d2596b256d239390d14c1b9c3de50eede1b93a60..6b878ab13cf003779c8408f2699e20e2a8dac459 100644 (file)
@@ -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, "]");
            }
index f9cb626fd6872ba348d77344e51dabb8f3b72fd3..214466b447daff1c7fdece337078b40655627b14 100644 (file)
@@ -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))
        {
index 70a8308b047e2ef51cc06b808b033cb7310a6254..edde01b2f37a197eaa8c9976c5825d84bab68b41 100644 (file)
@@ -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;
 
index cf902ac7fbe1758ae2442887ae69e11f7625ca75..064e81905d0ddc035a03d2875902be145e9c3255 100644 (file)
@@ -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))
        {
index 7862f70d472b61f5aa66e80f9b056429f1f6b2a0..b871a6d167bb0e006b23ad8993838dcc9d8d0c33 100644 (file)
@@ -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);
index 0929daf0511090df9acc46aa5f0cad19e10d2eaf..7fe6d3d1eb6472acc12f65018f238fa43e9042e8 100644 (file)
@@ -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",
index 73b7d5a8dfc0a6dd32d1ab356dad1c280e797232..2d5c88f8d4d65d7e27aa248ff47a20c32e1b5b8b 100644 (file)
@@ -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:
index 82e63a33cbbd1fe9f28e3a5a72ccea69cd25415b..a5779a3aff978be2653d0667739d343454f0de5b 100644 (file)
@@ -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;
index bde4684a82b14fc0a00bcde773fd8dc10d13fa7e..2bc58ca4652a2d1af8ca4ae99b7251043b81fa23 100644 (file)
@@ -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"));
 
index ca7dab680aef1b9b3a569ea144d9aca79957c02a..7051fcef13f68e131d3faa922ec9a4b4605eeb22 100644 (file)
@@ -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);