aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--gdb/ChangeLog13
-rw-r--r--gdb/ada-typeprint.c8
-rw-r--r--gdb/ctfread.c2
-rw-r--r--gdb/dwarf2/loc.c16
-rw-r--r--gdb/dwarf2/read.c69
-rw-r--r--gdb/gdbtypes.c96
-rw-r--r--gdb/gdbtypes.h98
-rw-r--r--gdb/gnu-v3-abi.c3
-rw-r--r--gdb/mdebugread.c4
-rw-r--r--gdb/p-valprint.c2
-rw-r--r--gdb/rust-lang.c4
-rw-r--r--gdb/type-stack.c3
12 files changed, 183 insertions, 135 deletions
diff --git a/gdb/ChangeLog b/gdb/ChangeLog
index 162929f..2b6905d 100644
--- a/gdb/ChangeLog
+++ b/gdb/ChangeLog
@@ -1,3 +1,16 @@
+2020-07-12 Simon Marchi <simon.marchi@polymtl.ca>
+
+ * gdbtypes.h (struct dynamic_prop) <kind, set_undefined,
+ const_val, set_const_val, baton, set_locexpr, set_loclist,
+ set_addr_offset, variant_parts, set_variant_parts,
+ original_type, set_original_type>: New methods.
+ <kind>: Rename to...
+ <m_kind>: ... this. Update all users to use the new methods
+ instead.
+ <data>: Rename to...
+ <m_data>: ... this. Update all users to use the new methods
+ instead.
+
2020-07-12 Simon Marchi <simon.marchi@efficios.com>
* gdbtypes.c (get_discrete_bounds): Return failure if
diff --git a/gdb/ada-typeprint.c b/gdb/ada-typeprint.c
index 165ea0e..062b9d8 100644
--- a/gdb/ada-typeprint.c
+++ b/gdb/ada-typeprint.c
@@ -779,13 +779,13 @@ print_record_field_types (struct type *type, struct type *outer_type,
struct dynamic_prop *prop = type->dyn_prop (DYN_PROP_VARIANT_PARTS);
if (prop != nullptr)
{
- if (prop->kind == PROP_TYPE)
+ if (prop->kind () == PROP_TYPE)
{
- type = prop->data.original_type;
+ type = prop->original_type ();
prop = type->dyn_prop (DYN_PROP_VARIANT_PARTS);
}
- gdb_assert (prop->kind == PROP_VARIANT_PARTS);
- print_record_field_types_dynamic (*prop->data.variant_parts,
+ gdb_assert (prop->kind () == PROP_VARIANT_PARTS);
+ print_record_field_types_dynamic (*prop->variant_parts (),
0, type->num_fields (),
type, stream, show, level, flags);
return type->num_fields ();
diff --git a/gdb/ctfread.c b/gdb/ctfread.c
index f44cbec..5b6d731 100644
--- a/gdb/ctfread.c
+++ b/gdb/ctfread.c
@@ -774,7 +774,7 @@ read_array_type (struct ctf_context *ccp, ctf_id_t tid)
type = create_array_type (NULL, element_type, range_type);
if (ar.ctr_nelems <= 1) /* Check if undefined upper bound. */
{
- TYPE_HIGH_BOUND_KIND (range_type) = PROP_UNDEFINED;
+ range_type->bounds ()->high.set_undefined ();
TYPE_LENGTH (type) = 0;
TYPE_TARGET_STUB (type) = 1;
}
diff --git a/gdb/dwarf2/loc.c b/gdb/dwarf2/loc.c
index 445d71a..866417e 100644
--- a/gdb/dwarf2/loc.c
+++ b/gdb/dwarf2/loc.c
@@ -2589,12 +2589,12 @@ dwarf2_evaluate_property (const struct dynamic_prop *prop,
if (frame == NULL && has_stack_frames ())
frame = get_selected_frame (NULL);
- switch (prop->kind)
+ switch (prop->kind ())
{
case PROP_LOCEXPR:
{
const struct dwarf2_property_baton *baton
- = (const struct dwarf2_property_baton *) prop->data.baton;
+ = (const struct dwarf2_property_baton *) prop->baton ();
gdb_assert (baton->property_type != NULL);
if (dwarf2_locexpr_baton_eval (&baton->locexpr, frame, addr_stack,
@@ -2636,7 +2636,7 @@ dwarf2_evaluate_property (const struct dynamic_prop *prop,
case PROP_LOCLIST:
{
struct dwarf2_property_baton *baton
- = (struct dwarf2_property_baton *) prop->data.baton;
+ = (struct dwarf2_property_baton *) prop->baton ();
CORE_ADDR pc;
const gdb_byte *data;
struct value *val;
@@ -2662,13 +2662,13 @@ dwarf2_evaluate_property (const struct dynamic_prop *prop,
break;
case PROP_CONST:
- *value = prop->data.const_val;
+ *value = prop->const_val ();
return true;
case PROP_ADDR_OFFSET:
{
struct dwarf2_property_baton *baton
- = (struct dwarf2_property_baton *) prop->data.baton;
+ = (struct dwarf2_property_baton *) prop->baton ();
const struct property_addr_info *pinfo;
struct value *val;
@@ -2708,13 +2708,13 @@ dwarf2_compile_property_to_c (string_file *stream,
struct symbol *sym)
{
struct dwarf2_property_baton *baton
- = (struct dwarf2_property_baton *) prop->data.baton;
+ = (struct dwarf2_property_baton *) prop->baton ();
const gdb_byte *data;
size_t size;
dwarf2_per_cu_data *per_cu;
dwarf2_per_objfile *per_objfile;
- if (prop->kind == PROP_LOCEXPR)
+ if (prop->kind () == PROP_LOCEXPR)
{
data = baton->locexpr.data;
size = baton->locexpr.size;
@@ -2723,7 +2723,7 @@ dwarf2_compile_property_to_c (string_file *stream,
}
else
{
- gdb_assert (prop->kind == PROP_LOCLIST);
+ gdb_assert (prop->kind () == PROP_LOCLIST);
data = dwarf2_find_location_expression (&baton->loclist, &size, pc);
per_cu = baton->loclist.per_cu;
diff --git a/gdb/dwarf2/read.c b/gdb/dwarf2/read.c
index bc8f4a1..558fad7 100644
--- a/gdb/dwarf2/read.c
+++ b/gdb/dwarf2/read.c
@@ -9464,8 +9464,7 @@ alloc_rust_variant (struct obstack *obstack, struct type *type,
= new (storage) gdb::array_view<variant_part> (part, 1);
struct dynamic_prop prop;
- prop.kind = PROP_VARIANT_PARTS;
- prop.data.variant_parts = prop_value;
+ prop.set_variant_parts (prop_value);
type->add_dyn_prop (DYN_PROP_VARIANT_PARTS, prop);
}
@@ -14959,10 +14958,9 @@ add_variant_property (struct field_info *fip, struct type *type,
fip->variant_parts);
struct dynamic_prop prop;
- prop.kind = PROP_VARIANT_PARTS;
- prop.data.variant_parts
- = ((gdb::array_view<variant_part> *)
- obstack_copy (&objfile->objfile_obstack, &parts, sizeof (parts)));
+ prop.set_variant_parts ((gdb::array_view<variant_part> *)
+ obstack_copy (&objfile->objfile_obstack, &parts,
+ sizeof (parts)));
type->add_dyn_prop (DYN_PROP_VARIANT_PARTS, prop);
}
@@ -17138,8 +17136,7 @@ read_tag_string_type (struct die_info *die, struct dwarf2_cu *cu)
{
struct dynamic_prop low_bound;
- low_bound.kind = PROP_CONST;
- low_bound.data.const_val = 1;
+ low_bound.set_const_val (1);
range_type = create_range_type (NULL, index_type, &low_bound, &prop, 0);
}
char_type = language_string_char_type (cu->language_defn, gdbarch);
@@ -17646,9 +17643,9 @@ attr_to_dynamic_prop (const struct attribute *attr, struct die_info *die,
baton->locexpr.is_reference = false;
break;
}
- prop->data.baton = baton;
- prop->kind = PROP_LOCEXPR;
- gdb_assert (prop->data.baton != NULL);
+
+ prop->set_locexpr (baton);
+ gdb_assert (prop->baton () != NULL);
}
else if (attr->form_is_ref ())
{
@@ -17672,9 +17669,8 @@ attr_to_dynamic_prop (const struct attribute *attr, struct die_info *die,
baton = XOBNEW (obstack, struct dwarf2_property_baton);
baton->property_type = die_type (target_die, target_cu);
fill_in_loclist_baton (cu, &baton->loclist, target_attr);
- prop->data.baton = baton;
- prop->kind = PROP_LOCLIST;
- gdb_assert (prop->data.baton != NULL);
+ prop->set_loclist (baton);
+ gdb_assert (prop->baton () != NULL);
}
else if (target_attr->form_is_block ())
{
@@ -17685,9 +17681,8 @@ attr_to_dynamic_prop (const struct attribute *attr, struct die_info *die,
baton->locexpr.size = DW_BLOCK (target_attr)->size;
baton->locexpr.data = DW_BLOCK (target_attr)->data;
baton->locexpr.is_reference = true;
- prop->data.baton = baton;
- prop->kind = PROP_LOCEXPR;
- gdb_assert (prop->data.baton != NULL);
+ prop->set_locexpr (baton);
+ gdb_assert (prop->baton () != NULL);
}
else
{
@@ -17709,17 +17704,13 @@ attr_to_dynamic_prop (const struct attribute *attr, struct die_info *die,
target_cu);
baton->offset_info.offset = offset;
baton->offset_info.type = die_type (target_die, target_cu);
- prop->data.baton = baton;
- prop->kind = PROP_ADDR_OFFSET;
+ prop->set_addr_offset (baton);
break;
}
}
}
else if (attr->form_is_constant ())
- {
- prop->data.const_val = attr->constant_value (0);
- prop->kind = PROP_CONST;
- }
+ prop->set_const_val (attr->constant_value (0));
else
{
dwarf2_invalid_attrib_class_complaint (dwarf_form_name (attr->form),
@@ -17819,9 +17810,7 @@ read_subrange_type (struct die_info *die, struct dwarf2_cu *cu)
if (range_type)
return range_type;
- low.kind = PROP_CONST;
- high.kind = PROP_CONST;
- high.data.const_val = 0;
+ high.set_const_val (0);
/* Set LOW_DEFAULT_IS_VALID if current language and DWARF version allow
omitting DW_AT_lower_bound. */
@@ -17829,27 +17818,27 @@ read_subrange_type (struct die_info *die, struct dwarf2_cu *cu)
{
case language_c:
case language_cplus:
- low.data.const_val = 0;
+ low.set_const_val (0);
low_default_is_valid = 1;
break;
case language_fortran:
- low.data.const_val = 1;
+ low.set_const_val (1);
low_default_is_valid = 1;
break;
case language_d:
case language_objc:
case language_rust:
- low.data.const_val = 0;
+ low.set_const_val (0);
low_default_is_valid = (cu->header.version >= 4);
break;
case language_ada:
case language_m2:
case language_pascal:
- low.data.const_val = 1;
+ low.set_const_val (1);
low_default_is_valid = (cu->header.version >= 4);
break;
default:
- low.data.const_val = 0;
+ low.set_const_val (0);
low_default_is_valid = 0;
break;
}
@@ -17871,8 +17860,8 @@ read_subrange_type (struct die_info *die, struct dwarf2_cu *cu)
if (attr_to_dynamic_prop (attr, die, cu, &high, base_type))
{
/* If bounds are constant do the final calculation here. */
- if (low.kind == PROP_CONST && high.kind == PROP_CONST)
- high.data.const_val = low.data.const_val + high.data.const_val - 1;
+ if (low.kind () == PROP_CONST && high.kind () == PROP_CONST)
+ high.set_const_val (low.const_val () + high.const_val () - 1);
else
high_bound_is_count = 1;
}
@@ -17905,12 +17894,12 @@ read_subrange_type (struct die_info *die, struct dwarf2_cu *cu)
the base type is signed. */
negative_mask =
-((ULONGEST) 1 << (TYPE_LENGTH (base_type) * TARGET_CHAR_BIT - 1));
- if (low.kind == PROP_CONST
- && !TYPE_UNSIGNED (base_type) && (low.data.const_val & negative_mask))
- low.data.const_val |= negative_mask;
- if (high.kind == PROP_CONST
- && !TYPE_UNSIGNED (base_type) && (high.data.const_val & negative_mask))
- high.data.const_val |= negative_mask;
+ if (low.kind () == PROP_CONST
+ && !TYPE_UNSIGNED (base_type) && (low.const_val () & negative_mask))
+ low.set_const_val (low.const_val () | negative_mask);
+ if (high.kind () == PROP_CONST
+ && !TYPE_UNSIGNED (base_type) && (high.const_val () & negative_mask))
+ high.set_const_val (high.const_val () | negative_mask);
/* Check for bit and byte strides. */
struct dynamic_prop byte_stride_prop;
@@ -17962,7 +17951,7 @@ read_subrange_type (struct die_info *die, struct dwarf2_cu *cu)
/* Ada expects an empty array on no boundary attributes. */
if (attr == NULL && cu->language != language_ada)
- TYPE_HIGH_BOUND_KIND (range_type) = PROP_UNDEFINED;
+ range_type->bounds ()->high.set_undefined ();
name = dwarf2_name (die, cu);
if (name)
diff --git a/gdb/gdbtypes.c b/gdb/gdbtypes.c
index 4016556..7095745 100644
--- a/gdb/gdbtypes.c
+++ b/gdb/gdbtypes.c
@@ -874,23 +874,23 @@ allocate_stub_method (struct type *type)
bool
operator== (const dynamic_prop &l, const dynamic_prop &r)
{
- if (l.kind != r.kind)
+ if (l.kind () != r.kind ())
return false;
- switch (l.kind)
+ switch (l.kind ())
{
case PROP_UNDEFINED:
return true;
case PROP_CONST:
- return l.data.const_val == r.data.const_val;
+ return l.const_val () == r.const_val ();
case PROP_ADDR_OFFSET:
case PROP_LOCEXPR:
case PROP_LOCLIST:
- return l.data.baton == r.data.baton;
+ return l.baton () == r.baton ();
case PROP_VARIANT_PARTS:
- return l.data.variant_parts == r.data.variant_parts;
+ return l.variant_parts () == r.variant_parts ();
case PROP_TYPE:
- return l.data.original_type == r.data.original_type;
+ return l.original_type () == r.original_type ();
}
gdb_assert_not_reached ("unhandled dynamic_prop kind");
@@ -940,21 +940,18 @@ create_range_type (struct type *result_type, struct type *index_type,
bounds->low = *low_bound;
bounds->high = *high_bound;
bounds->bias = bias;
-
- /* Initialize the stride to be a constant, the value will already be zero
- thanks to the use of TYPE_ZALLOC above. */
- bounds->stride.kind = PROP_CONST;
+ bounds->stride.set_const_val (0);
result_type->set_bounds (bounds);
- if (low_bound->kind == PROP_CONST && low_bound->data.const_val >= 0)
+ if (low_bound->kind () == PROP_CONST && low_bound->const_val () >= 0)
TYPE_UNSIGNED (result_type) = 1;
/* Ada allows the declaration of range types whose upper bound is
less than the lower bound, so checking the lower bound is not
enough. Make sure we do not mark a range type whose upper bound
is negative as unsigned. */
- if (high_bound->kind == PROP_CONST && high_bound->data.const_val < 0)
+ if (high_bound->kind () == PROP_CONST && high_bound->const_val () < 0)
TYPE_UNSIGNED (result_type) = 0;
TYPE_ENDIANITY_NOT_DEFAULT (result_type)
@@ -1002,11 +999,8 @@ create_static_range_type (struct type *result_type, struct type *index_type,
{
struct dynamic_prop low, high;
- low.kind = PROP_CONST;
- low.data.const_val = low_bound;
-
- high.kind = PROP_CONST;
- high.data.const_val = high_bound;
+ low.set_const_val (low_bound);
+ high.set_const_val (high_bound);
result_type = create_range_type (result_type, index_type, &low, &high, 0);
@@ -1021,9 +1015,9 @@ has_static_range (const struct range_bounds *bounds)
{
/* If the range doesn't have a defined stride then its stride field will
be initialized to the constant 0. */
- return (bounds->low.kind == PROP_CONST
- && bounds->high.kind == PROP_CONST
- && bounds->stride.kind == PROP_CONST);
+ return (bounds->low.kind () == PROP_CONST
+ && bounds->high.kind () == PROP_CONST
+ && bounds->stride.kind () == PROP_CONST);
}
@@ -1273,13 +1267,13 @@ create_array_type_with_stride (struct type *result_type,
unsigned int bit_stride)
{
if (byte_stride_prop != NULL
- && byte_stride_prop->kind == PROP_CONST)
+ && byte_stride_prop->kind () == PROP_CONST)
{
/* The byte stride is actually not dynamic. Pretend we were
called with bit_stride set instead of byte_stride_prop.
This will give us the same result type, while avoiding
the need to handle this as a special case. */
- bit_stride = byte_stride_prop->data.const_val * 8;
+ bit_stride = byte_stride_prop->const_val () * 8;
byte_stride_prop = NULL;
}
@@ -1967,7 +1961,7 @@ array_type_has_dynamic_stride (struct type *type)
{
struct dynamic_prop *prop = type->dyn_prop (DYN_PROP_BYTE_STRIDE);
- return (prop != NULL && prop->kind != PROP_CONST);
+ return (prop != NULL && prop->kind () != PROP_CONST);
}
/* Worker for is_dynamic_type. */
@@ -1999,7 +1993,7 @@ is_dynamic_type_internal (struct type *type, int top_level)
return 1;
struct dynamic_prop *prop = type->dyn_prop (DYN_PROP_VARIANT_PARTS);
- if (prop != nullptr && prop->kind != PROP_TYPE)
+ if (prop != nullptr && prop->kind () != PROP_TYPE)
return 1;
if (TYPE_HAS_DYNAMIC_LENGTH (type))
@@ -2097,38 +2091,27 @@ resolve_dynamic_range (struct type *dyn_range_type,
const struct dynamic_prop *prop = &dyn_range_type->bounds ()->low;
if (dwarf2_evaluate_property (prop, NULL, addr_stack, &value))
- {
- low_bound.kind = PROP_CONST;
- low_bound.data.const_val = value;
- }
+ low_bound.set_const_val (value);
else
- {
- low_bound.kind = PROP_UNDEFINED;
- low_bound.data.const_val = 0;
- }
+ low_bound.set_undefined ();
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;
+ high_bound.set_const_val (value);
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;
+ high_bound.set_const_val
+ (low_bound.const_val () + high_bound.const_val () - 1);
}
else
- {
- high_bound.kind = PROP_UNDEFINED;
- high_bound.data.const_val = 0;
- }
+ high_bound.set_undefined ();
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;
- stride.data.const_val = value;
+ stride.set_const_val (value);
/* If we have a bit stride that is not an exact number of bytes then
I really don't think this is going to work with current GDB, the
@@ -2142,8 +2125,7 @@ resolve_dynamic_range (struct type *dyn_range_type,
}
else
{
- stride.kind = PROP_UNDEFINED;
- stride.data.const_val = 0;
+ stride.set_undefined ();
byte_stride_p = true;
}
@@ -2188,16 +2170,11 @@ resolve_dynamic_array_or_string (struct type *type,
will update the length of the array accordingly. */
prop = TYPE_ALLOCATED_PROP (type);
if (prop != NULL && dwarf2_evaluate_property (prop, NULL, addr_stack, &value))
- {
- TYPE_DYN_PROP_ADDR (prop) = value;
- TYPE_DYN_PROP_KIND (prop) = PROP_CONST;
- }
+ prop->set_const_val (value);
+
prop = TYPE_ASSOCIATED_PROP (type);
if (prop != NULL && dwarf2_evaluate_property (prop, NULL, addr_stack, &value))
- {
- TYPE_DYN_PROP_ADDR (prop) = value;
- TYPE_DYN_PROP_KIND (prop) = PROP_CONST;
- }
+ prop->set_const_val (value);
ary_dim = check_typedef (TYPE_TARGET_TYPE (elt_type));
@@ -2447,14 +2424,13 @@ resolve_dynamic_struct (struct type *type,
resolved_type = copy_type (type);
dynamic_prop *variant_prop = resolved_type->dyn_prop (DYN_PROP_VARIANT_PARTS);
- if (variant_prop != nullptr && variant_prop->kind == PROP_VARIANT_PARTS)
+ if (variant_prop != nullptr && variant_prop->kind () == PROP_VARIANT_PARTS)
{
compute_variant_fields (type, resolved_type, addr_stack,
- *variant_prop->data.variant_parts);
+ *variant_prop->variant_parts ());
/* We want to leave the property attached, so that the Rust code
can tell whether the type was originally an enum. */
- variant_prop->kind = PROP_TYPE;
- variant_prop->data.original_type = type;
+ variant_prop->set_original_type (type);
}
else
{
@@ -2483,8 +2459,7 @@ resolve_dynamic_struct (struct type *type,
baton.locexpr = *TYPE_FIELD_DWARF_BLOCK (resolved_type, i);
struct dynamic_prop prop;
- prop.kind = PROP_LOCEXPR;
- prop.data.baton = &baton;
+ prop.set_locexpr (&baton);
CORE_ADDR addr;
if (dwarf2_evaluate_property (&prop, nullptr, addr_stack, &addr,
@@ -2642,10 +2617,7 @@ resolve_dynamic_type_internal (struct type *type,
prop = TYPE_DATA_LOCATION (resolved_type);
if (prop != NULL
&& dwarf2_evaluate_property (prop, NULL, addr_stack, &value))
- {
- TYPE_DYN_PROP_ADDR (prop) = value;
- TYPE_DYN_PROP_KIND (prop) = PROP_CONST;
- }
+ prop->set_const_val (value);
return resolved_type;
}
diff --git a/gdb/gdbtypes.h b/gdb/gdbtypes.h
index 2a1e693..5d9ed39 100644
--- a/gdb/gdbtypes.h
+++ b/gdb/gdbtypes.h
@@ -511,11 +511,87 @@ union dynamic_prop_data
struct dynamic_prop
{
+ dynamic_prop_kind kind () const
+ {
+ return m_kind;
+ }
+
+ void set_undefined ()
+ {
+ m_kind = PROP_UNDEFINED;
+ }
+
+ LONGEST const_val () const
+ {
+ gdb_assert (m_kind == PROP_CONST);
+
+ return m_data.const_val;
+ }
+
+ void set_const_val (LONGEST const_val)
+ {
+ m_kind = PROP_CONST;
+ m_data.const_val = const_val;
+ }
+
+ void *baton () const
+ {
+ gdb_assert (m_kind == PROP_LOCEXPR
+ || m_kind == PROP_LOCLIST
+ || m_kind == PROP_ADDR_OFFSET);
+
+ return m_data.baton;
+ }
+
+ void set_locexpr (void *baton)
+ {
+ m_kind = PROP_LOCEXPR;
+ m_data.baton = baton;
+ }
+
+ void set_loclist (void *baton)
+ {
+ m_kind = PROP_LOCLIST;
+ m_data.baton = baton;
+ }
+
+ void set_addr_offset (void *baton)
+ {
+ m_kind = PROP_ADDR_OFFSET;
+ m_data.baton = baton;
+ }
+
+ const gdb::array_view<variant_part> *variant_parts () const
+ {
+ gdb_assert (m_kind == PROP_VARIANT_PARTS);
+
+ return m_data.variant_parts;
+ }
+
+ void set_variant_parts (gdb::array_view<variant_part> *variant_parts)
+ {
+ m_kind = PROP_VARIANT_PARTS;
+ m_data.variant_parts = variant_parts;
+ }
+
+ struct type *original_type () const
+ {
+ gdb_assert (m_kind == PROP_TYPE);
+
+ return m_data.original_type;
+ }
+
+ void set_original_type (struct type *original_type)
+ {
+ m_kind = PROP_TYPE;
+ m_data.original_type = original_type;
+ }
+
/* Determine which field of the union dynamic_prop.data is used. */
- enum dynamic_prop_kind kind;
+ enum dynamic_prop_kind m_kind;
/* Storage for dynamic or static value. */
- union dynamic_prop_data data;
+ union dynamic_prop_data m_data;
};
/* Compare two dynamic_prop objects for equality. dynamic_prop
@@ -1519,19 +1595,19 @@ extern unsigned type_align (struct type *);
extern bool set_type_align (struct type *, ULONGEST);
#define TYPE_LOW_BOUND(range_type) \
- ((range_type)->bounds ()->low.data.const_val)
+ ((range_type)->bounds ()->low.const_val ())
#define TYPE_HIGH_BOUND(range_type) \
- ((range_type)->bounds ()->high.data.const_val)
+ ((range_type)->bounds ()->high.const_val ())
#define TYPE_LOW_BOUND_UNDEFINED(range_type) \
(TYPE_LOW_BOUND_KIND(range_type) == PROP_UNDEFINED)
#define TYPE_HIGH_BOUND_UNDEFINED(range_type) \
(TYPE_HIGH_BOUND_KIND(range_type) == PROP_UNDEFINED)
#define TYPE_HIGH_BOUND_KIND(range_type) \
- ((range_type)->bounds ()->high.kind)
+ ((range_type)->bounds ()->high.kind ())
#define TYPE_LOW_BOUND_KIND(range_type) \
- ((range_type)->bounds ()->low.kind)
+ ((range_type)->bounds ()->low.kind ())
#define TYPE_BIT_STRIDE(range_type) \
- ((range_type)->bounds ()->stride.data.const_val \
+ ((range_type)->bounds ()->stride.const_val () \
* ((range_type)->bounds ()->flag_is_byte_stride ? 8 : 1))
/* Property accessors for the type data location. */
@@ -1540,9 +1616,9 @@ extern bool set_type_align (struct type *, ULONGEST);
#define TYPE_DATA_LOCATION_BATON(thistype) \
TYPE_DATA_LOCATION (thistype)->data.baton
#define TYPE_DATA_LOCATION_ADDR(thistype) \
- TYPE_DATA_LOCATION (thistype)->data.const_val
+ (TYPE_DATA_LOCATION (thistype)->const_val ())
#define TYPE_DATA_LOCATION_KIND(thistype) \
- TYPE_DATA_LOCATION (thistype)->kind
+ (TYPE_DATA_LOCATION (thistype)->kind ())
#define TYPE_DYNAMIC_LENGTH(thistype) \
((thistype)->dyn_prop (DYN_PROP_BYTE_SIZE))
@@ -1556,9 +1632,9 @@ extern bool set_type_align (struct type *, ULONGEST);
#define TYPE_DYN_PROP_BATON(dynprop) \
dynprop->data.baton
#define TYPE_DYN_PROP_ADDR(dynprop) \
- dynprop->data.const_val
+ (dynprop->const_val ())
#define TYPE_DYN_PROP_KIND(dynprop) \
- dynprop->kind
+ (dynprop->kind ())
/* Accessors for struct range_bounds data attached to an array type's
diff --git a/gdb/gnu-v3-abi.c b/gdb/gnu-v3-abi.c
index 23c9c94..beff8b1 100644
--- a/gdb/gnu-v3-abi.c
+++ b/gdb/gnu-v3-abi.c
@@ -471,8 +471,7 @@ gnuv3_baseclass_offset (struct type *type, int index,
baton.locexpr = *TYPE_FIELD_DWARF_BLOCK (type, index);
struct dynamic_prop prop;
- prop.kind = PROP_LOCEXPR;
- prop.data.baton = &baton;
+ prop.set_locexpr (&baton);
struct property_addr_info addr_stack;
addr_stack.type = type;
diff --git a/gdb/mdebugread.c b/gdb/mdebugread.c
index aa0c715..d383720 100644
--- a/gdb/mdebugread.c
+++ b/gdb/mdebugread.c
@@ -1736,9 +1736,9 @@ parse_type (int fd, union aux_ext *ax, unsigned int aux_index, int *bs,
tp->set_num_fields (0);
tp->set_bounds (((struct range_bounds *)
TYPE_ZALLOC (tp, sizeof (struct range_bounds))));
- TYPE_LOW_BOUND (tp) = AUX_GET_DNLOW (bigend, ax);
+ tp->bounds ()->low.set_const_val (AUX_GET_DNLOW (bigend, ax));
ax++;
- TYPE_HIGH_BOUND (tp) = AUX_GET_DNHIGH (bigend, ax);
+ tp->bounds ()->high.set_const_val (AUX_GET_DNHIGH (bigend, ax));
ax++;
}
diff --git a/gdb/p-valprint.c b/gdb/p-valprint.c
index 3b1303d..c98f3c5 100644
--- a/gdb/p-valprint.c
+++ b/gdb/p-valprint.c
@@ -350,7 +350,7 @@ pascal_value_print_inner (struct value *val, struct ui_file *stream,
maximum value. */
bound_info = 0;
high_bound = TYPE_LENGTH (type) * TARGET_CHAR_BIT - 1;
- TYPE_HIGH_BOUND (range) = high_bound;
+ range->bounds ()->high.set_const_val (high_bound);
}
maybe_bad_bstring:
if (bound_info < 0)
diff --git a/gdb/rust-lang.c b/gdb/rust-lang.c
index d1efea1..31126a2 100644
--- a/gdb/rust-lang.c
+++ b/gdb/rust-lang.c
@@ -653,8 +653,8 @@ rust_print_struct_def (struct type *type, const char *varstring,
{
fputs_filtered ("enum ", stream);
dynamic_prop *prop = type->dyn_prop (DYN_PROP_VARIANT_PARTS);
- if (prop != nullptr && prop->kind == PROP_TYPE)
- type = prop->data.original_type;
+ if (prop != nullptr && prop->kind () == PROP_TYPE)
+ type = prop->original_type ();
}
else if (type->code () == TYPE_CODE_STRUCT)
fputs_filtered ("struct ", stream);
diff --git a/gdb/type-stack.c b/gdb/type-stack.c
index 2d5c88f..fae3216 100644
--- a/gdb/type-stack.c
+++ b/gdb/type-stack.c
@@ -172,8 +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 (follow_type->index_type ())
- = PROP_UNDEFINED;
+ follow_type->index_type ()->bounds ()->high.set_undefined ();
break;
case tp_function:
/* FIXME-type-allocation: need a way to free this type when we are