gdb: remove TYPE_LOW_BOUND_KIND and TYPE_HIGH_BOUND_KIND

Remove the macros, use the getters of `struct dynamic_prop` instead.

gdb/ChangeLog:

	* gdbtypes.h (TYPE_LOW_BOUND_KIND,
	TYPE_HIGH_BOUND_KIND): Remove.  Update all callers
	to use dynamic_prop::kind.

Change-Id: Icb1fc761f675bfac934209f8102392504d905c44
This commit is contained in:
Simon Marchi
2020-07-12 22:58:52 -04:00
committed by Simon Marchi
parent 064d9cb9e7
commit 3b606f384d
7 changed files with 18 additions and 16 deletions

View File

@@ -1,3 +1,9 @@
2020-07-12 Simon Marchi <simon.marchi@efficios.com>
* gdbtypes.h (TYPE_LOW_BOUND_KIND,
TYPE_HIGH_BOUND_KIND): Remove. Update all callers
to use dynamic_prop::kind.
2020-07-12 Simon Marchi <simon.marchi@efficios.com> 2020-07-12 Simon Marchi <simon.marchi@efficios.com>
* gdbtypes.h (TYPE_LOW_BOUND_UNDEFINED, * gdbtypes.h (TYPE_LOW_BOUND_UNDEFINED,

View File

@@ -780,8 +780,8 @@ c_type_print_varspec_suffix (struct type *type,
fprintf_filtered (stream, (is_vector ? fprintf_filtered (stream, (is_vector ?
" __attribute__ ((vector_size(" : "[")); " __attribute__ ((vector_size(" : "["));
/* Bounds are not yet resolved, print a bounds placeholder instead. */ /* Bounds are not yet resolved, print a bounds placeholder instead. */
if (TYPE_HIGH_BOUND_KIND (type->index_type ()) == PROP_LOCEXPR if (type->index_type ()->bounds ()->high.kind () == PROP_LOCEXPR
|| TYPE_HIGH_BOUND_KIND (type->index_type ()) == PROP_LOCLIST) || type->index_type ()->bounds ()->high.kind () == PROP_LOCLIST)
fprintf_filtered (stream, "variable length"); fprintf_filtered (stream, "variable length");
else if (get_array_bounds (type, &low_bound, &high_bound)) else if (get_array_bounds (type, &low_bound, &high_bound))
fprintf_filtered (stream, "%s", fprintf_filtered (stream, "%s",

View File

@@ -501,8 +501,8 @@ generate_vla_size (compile_instance *compiler,
{ {
case TYPE_CODE_RANGE: case TYPE_CODE_RANGE:
{ {
if (TYPE_HIGH_BOUND_KIND (type) == PROP_LOCEXPR if (type->bounds ()->high.kind () == PROP_LOCEXPR
|| TYPE_HIGH_BOUND_KIND (type) == PROP_LOCLIST) || type->bounds ()->high.kind () == PROP_LOCLIST)
{ {
const struct dynamic_prop *prop = &type->bounds ()->high; const struct dynamic_prop *prop = &type->bounds ()->high;
std::string name = c_get_range_decl_name (prop); std::string name = c_get_range_decl_name (prop);

View File

@@ -44,15 +44,15 @@ convert_array (compile_c_instance *context, struct type *type)
element_type = context->convert_type (TYPE_TARGET_TYPE (type)); element_type = context->convert_type (TYPE_TARGET_TYPE (type));
if (TYPE_LOW_BOUND_KIND (range) != PROP_CONST) if (range->bounds ()->low.kind () != PROP_CONST)
return context->plugin ().error (_("array type with non-constant" return context->plugin ().error (_("array type with non-constant"
" lower bound is not supported")); " lower bound is not supported"));
if (range->bounds ()->low.const_val () != 0) if (range->bounds ()->low.const_val () != 0)
return context->plugin ().error (_("cannot convert array type with " return context->plugin ().error (_("cannot convert array type with "
"non-zero lower bound to C")); "non-zero lower bound to C"));
if (TYPE_HIGH_BOUND_KIND (range) == PROP_LOCEXPR if (range->bounds ()->high.kind () == PROP_LOCEXPR
|| TYPE_HIGH_BOUND_KIND (range) == PROP_LOCLIST) || range->bounds ()->high.kind () == PROP_LOCLIST)
{ {
gcc_type result; gcc_type result;

View File

@@ -456,7 +456,7 @@ compile_cplus_convert_array (compile_cplus_instance *instance,
struct type *range = type->index_type (); struct type *range = type->index_type ();
gcc_type element_type = instance->convert_type (TYPE_TARGET_TYPE (type)); gcc_type element_type = instance->convert_type (TYPE_TARGET_TYPE (type));
if (TYPE_LOW_BOUND_KIND (range) != PROP_CONST) if (range->bounds ()->low.kind () != PROP_CONST)
{ {
const char *s = _("array type with non-constant" const char *s = _("array type with non-constant"
" lower bound is not supported"); " lower bound is not supported");
@@ -472,8 +472,8 @@ compile_cplus_convert_array (compile_cplus_instance *instance,
return instance->plugin ().error (s); return instance->plugin ().error (s);
} }
if (TYPE_HIGH_BOUND_KIND (range) == PROP_LOCEXPR if (range->bounds ()->high.kind () == PROP_LOCEXPR
|| TYPE_HIGH_BOUND_KIND (range) == PROP_LOCLIST) || range->bounds ()->high.kind () == PROP_LOCLIST)
{ {
if (TYPE_VECTOR (type)) if (TYPE_VECTOR (type))
{ {

View File

@@ -1594,10 +1594,6 @@ extern unsigned type_align (struct type *);
space in struct type. */ space in struct type. */
extern bool set_type_align (struct type *, ULONGEST); extern bool set_type_align (struct type *, ULONGEST);
#define TYPE_HIGH_BOUND_KIND(range_type) \
((range_type)->bounds ()->high.kind ())
#define TYPE_LOW_BOUND_KIND(range_type) \
((range_type)->bounds ()->low.kind ())
#define TYPE_BIT_STRIDE(range_type) \ #define TYPE_BIT_STRIDE(range_type) \
((range_type)->bounds ()->stride.const_val () \ ((range_type)->bounds ()->stride.const_val () \
* ((range_type)->bounds ()->flag_is_byte_stride ? 8 : 1)) * ((range_type)->bounds ()->flag_is_byte_stride ? 8 : 1))

View File

@@ -813,8 +813,8 @@ rust_internal_print_type (struct type *type, const char *varstring,
stream, show - 1, level, flags, false, stream, show - 1, level, flags, false,
podata); podata);
if (TYPE_HIGH_BOUND_KIND (type->index_type ()) == PROP_LOCEXPR if (type->index_type ()->bounds ()->high.kind () == PROP_LOCEXPR
|| TYPE_HIGH_BOUND_KIND (type->index_type ()) == PROP_LOCLIST) || type->index_type ()->bounds ()->high.kind () == PROP_LOCLIST)
fprintf_filtered (stream, "; variable length"); fprintf_filtered (stream, "; variable length");
else if (get_array_bounds (type, &low_bound, &high_bound)) else if (get_array_bounds (type, &low_bound, &high_bound))
fprintf_filtered (stream, "; %s", fprintf_filtered (stream, "; %s",