]> git.ipfire.org Git - thirdparty/binutils-gdb.git/commitdiff
gdb: remove TYPE_RANGE_DATA macro
authorSimon Marchi <simon.marchi@polymtl.ca>
Mon, 13 Jul 2020 02:58:51 +0000 (22:58 -0400)
committerSimon Marchi <simon.marchi@polymtl.ca>
Mon, 13 Jul 2020 02:58:51 +0000 (22:58 -0400)
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

gdb/ChangeLog
gdb/ada-lang.c
gdb/compile/compile-c-symbols.c
gdb/compile/compile-c-types.c
gdb/compile/compile-cplus-types.c
gdb/dwarf2/read.c
gdb/eval.c
gdb/gdbtypes.c
gdb/gdbtypes.h
gdb/printcmd.c
gdb/value.c

index 09bcc670146d3b23de4a53ac50924f816dda80d2..90168a3d017e446131935df702b5d9487b33f3b7 100644 (file)
@@ -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.
index cbcceba838de6b4d07f9343179c187be0a126158..88ab7dddde47ea8309e58de5becc5869185141c9 100644 (file)
@@ -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;
     }
 }
 
index 4ff757acc6aea09db70f23b6bffee2e0ffa2c230..be2ca35dead9dc2c59a0ddc5ac44959b2c881934 100644 (file)
@@ -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 (),
index aad35887666865dc9980de34700fd3d4984dba1d..e5050da03b865fd602021b1bde1c53522476200f 100644 (file)
@@ -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;
index b04d6c6e4eaaec8c9354b35d8d79cb6275fc6796..d07036020cf357628b839b4862dfc5ba24a1ab59 100644 (file)
@@ -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 ());
     }
index 405b5fb3348c94aad10e3bb40f393137ddb0759c..bc8f4a106d1daeaa381f37e64edcd10ec5dd47fd 100644 (file)
@@ -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)
index f975081621635f9382ff0e88d7bc61c56ae0ecc5..e28bfcbbd8130d3157842b76c76b9e1b61149307 100644 (file)
@@ -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
index 66f094328991b8bec58d1de25042cf55b19dadca..957307ec6120d27412f2761242a3d7e92062067b 100644 (file)
@@ -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
index 236d37b1ce2a2440456b49a6f548c5815c4e1670..2a1e6931b7fe802e02bf21a71b1c261118449ed4 100644 (file)
@@ -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) \
index 388a0b2c6d414450f6c54c5f463d538167b29a9b..309d2cabfff4c7c2cdf85b73a1421c9eca064e7c 100644 (file)
@@ -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));
index 00d8ded2ae0f1c3557ad5c6c39d5656f040a20b6..3a5b02bcb4659c0c54d0409930e2766a9f7a2489 100644 (file)
@@ -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: