]> git.ipfire.org Git - thirdparty/binutils-gdb.git/blobdiff - gdb/gdbtypes.h
gdb: remove TYPE_DYN_PROP_ADDR
[thirdparty/binutils-gdb.git] / gdb / gdbtypes.h
index 26db7935f2651d89d016dc79039a07adb9c3ec1f..55a6dafb7e29fde1b6ee8a71c08fb27baeb26bb0 100644 (file)
@@ -757,6 +757,14 @@ struct field
 
 struct range_bounds
 {
+  ULONGEST bit_stride () const
+  {
+    if (this->flag_is_byte_stride)
+      return this->stride.const_val () * 8;
+    else
+      return this->stride.const_val ();
+  }
+
   /* * Low bound of range.  */
 
   struct dynamic_prop low;
@@ -1032,9 +1040,19 @@ struct type
   /* Get the bounds bounds of this type.  The type must be a range type.  */
   range_bounds *bounds () const
   {
-    gdb_assert (this->code () == TYPE_CODE_RANGE);
-
-    return this->main_type->flds_bnds.bounds;
+    switch (this->code ())
+      {
+      case TYPE_CODE_RANGE:
+       return this->main_type->flds_bnds.bounds;
+
+      case TYPE_CODE_ARRAY:
+      case TYPE_CODE_STRING:
+       return this->index_type ()->bounds ();
+
+      default:
+       gdb_assert_not_reached
+         ("type::bounds called on type with invalid code");
+      }
   }
 
   /* Set the bounds of this type.  The type must be a range type.  */
@@ -1045,6 +1063,11 @@ struct type
     this->main_type->flds_bnds.bounds = bounds;
   }
 
+  ULONGEST bit_stride () const
+  {
+    return this->bounds ()->bit_stride ();
+  }
+
   /* * Return the dynamic property of the requested KIND from this type's
      list of dynamic properties.  */
   dynamic_prop *dyn_prop (dynamic_prop_node_kind kind) const;
@@ -1594,10 +1617,6 @@ extern unsigned type_align (struct type *);
    space in struct type.  */
 extern bool set_type_align (struct type *, ULONGEST);
 
-#define TYPE_BIT_STRIDE(range_type) \
-  ((range_type)->bounds ()->stride.const_val () \
-   * ((range_type)->bounds ()->flag_is_byte_stride ? 8 : 1))
-
 /* Property accessors for the type data location.  */
 #define TYPE_DATA_LOCATION(thistype) \
   ((thistype)->dyn_prop (DYN_PROP_DATA_LOCATION))
@@ -1616,21 +1635,6 @@ extern bool set_type_align (struct type *, ULONGEST);
 #define TYPE_ASSOCIATED_PROP(thistype) \
   ((thistype)->dyn_prop (DYN_PROP_ASSOCIATED))
 
-/* Attribute accessors for dynamic properties.  */
-#define TYPE_DYN_PROP_BATON(dynprop) \
-  dynprop->data.baton
-#define TYPE_DYN_PROP_ADDR(dynprop) \
-  (dynprop->const_val ())
-#define TYPE_DYN_PROP_KIND(dynprop) \
-  (dynprop->kind ())
-
-
-/* Accessors for struct range_bounds data attached to an array type's
-   index type.  */
-
-#define TYPE_ARRAY_BIT_STRIDE(arraytype) \
-  (TYPE_BIT_STRIDE(((arraytype)->index_type ())))
-
 /* C++ */
 
 #define TYPE_SELF_TYPE(thistype) internal_type_self_type (thistype)