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;
/* 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. */
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;
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))
#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)