/* All Fortran pointers should have the associated property, this is
how we know the pointer is pointing at something or not. */
struct type *pointer_type = check_typedef (pointer->type ());
- if (TYPE_ASSOCIATED_PROP (pointer_type) == nullptr
+ if (pointer_type->dyn_prop (DYN_PROP_ASSOCIATED) == nullptr
&& pointer_type->code () != TYPE_CODE_PTR)
error (_("ASSOCIATED can only be applied to pointers"));
This is probably true for most targets, but might not be true for
everyone. */
if (pointer_type->code () == TYPE_CODE_PTR
- && TYPE_ASSOCIATED_PROP (pointer_type) == nullptr)
+ && pointer_type->dyn_prop (DYN_PROP_ASSOCIATED) == nullptr)
is_associated = (pointer_addr != 0);
else
is_associated = !type_not_associated (pointer_type);
most targets, but might not be true for everyone. */
if (target->lval () != lval_memory
|| type_not_associated (pointer_type)
- || (TYPE_ASSOCIATED_PROP (pointer_type) == nullptr
+ || (pointer_type->dyn_prop (DYN_PROP_ASSOCIATED) == nullptr
&& pointer_type->code () == TYPE_CODE_PTR
&& pointer_addr == 0))
return value_from_longest (result_type, 0);
print_rank_only = true;
else if (type_not_allocated (type))
print_rank_only = true;
- else if ((TYPE_ASSOCIATED_PROP (type)
- && !TYPE_ASSOCIATED_PROP (type)->is_constant ())
- || (TYPE_ALLOCATED_PROP (type)
- && !TYPE_ALLOCATED_PROP (type)->is_constant ())
- || (TYPE_DATA_LOCATION (type)
- && !TYPE_DATA_LOCATION (type)->is_constant ()))
+ else if ((type->dyn_prop (DYN_PROP_ASSOCIATED)
+ && !type->dyn_prop (DYN_PROP_ASSOCIATED)->is_constant ())
+ || (type->dyn_prop (DYN_PROP_ALLOCATED)
+ && !type->dyn_prop (DYN_PROP_ALLOCATED)->is_constant ())
+ || (type->dyn_prop (DYN_PROP_DATA_LOCATION)
+ && !type->dyn_prop (DYN_PROP_DATA_LOCATION)->is_constant ()))
{
/* This case exist when we ptype a typename which has the dynamic
properties but cannot be resolved as there is no object. */
but it makes sense in this context, because the point is to determine
whether any part of the type needs to be resolved before it can
be exploited. */
- if (TYPE_DATA_LOCATION (type) != NULL
+ if (type->dyn_prop (DYN_PROP_DATA_LOCATION) != NULL
&& (TYPE_DATA_LOCATION_KIND (type) == PROP_LOCEXPR
|| TYPE_DATA_LOCATION_KIND (type) == PROP_LOCLIST))
return true;
- if (TYPE_ASSOCIATED_PROP (type))
+ if (type->dyn_prop (DYN_PROP_ASSOCIATED))
return true;
- if (TYPE_ALLOCATED_PROP (type))
+ if (type->dyn_prop (DYN_PROP_ALLOCATED))
return true;
struct dynamic_prop *prop = type->dyn_prop (DYN_PROP_VARIANT_PARTS);
not allocated/associated, as such we just ignore this property. This
is fine as GDB only checks the allocated/associated on the outer most
dimension of the array. */
- prop = TYPE_ALLOCATED_PROP (type);
+ prop = type->dyn_prop (DYN_PROP_ALLOCATED);
if (prop != NULL && resolve_p
&& dwarf2_evaluate_property (prop, frame, addr_stack, &value))
{
resolve_p = false;
}
- prop = TYPE_ASSOCIATED_PROP (type);
+ prop = type->dyn_prop (DYN_PROP_ASSOCIATED);
if (prop != NULL && resolve_p
&& dwarf2_evaluate_property (prop, frame, addr_stack, &value))
{
type = copy_type (type);
/* Resolve the rank property to get rank value. */
- struct dynamic_prop *prop = TYPE_RANK_PROP (type);
+ struct dynamic_prop *prop = type->dyn_prop (DYN_PROP_RANK);
if (dwarf2_evaluate_property (prop, frame, addr_stack, &value))
{
prop->set_const_val (value);
return type;
std::optional<CORE_ADDR> type_length;
- prop = TYPE_DYNAMIC_LENGTH (type);
+ prop = type->dyn_prop (DYN_PROP_BYTE_SIZE);
if (prop != NULL
&& dwarf2_evaluate_property (prop, frame, addr_stack, &value))
type_length = value;
}
/* Resolve data_location attribute. */
- prop = TYPE_DATA_LOCATION (resolved_type);
+ prop = resolved_type->dyn_prop (DYN_PROP_DATA_LOCATION);
if (prop != NULL
&& dwarf2_evaluate_property (prop, frame, addr_stack, &value))
{
int
type_not_allocated (const struct type *type)
{
- struct dynamic_prop *prop = TYPE_ALLOCATED_PROP (type);
+ struct dynamic_prop *prop = type->dyn_prop (DYN_PROP_ALLOCATED);
return prop != nullptr && prop->is_constant () && prop->const_val () == 0;
}
int
type_not_associated (const struct type *type)
{
- struct dynamic_prop *prop = TYPE_ASSOCIATED_PROP (type);
+ struct dynamic_prop *prop = type->dyn_prop (DYN_PROP_ASSOCIATED);
return prop != nullptr && prop->is_constant () && prop->const_val () == 0;
}
}
gdb_puts ("\n");
gdb_printf ("%*snfields %d ", spaces, "", type->num_fields ());
- if (TYPE_ASSOCIATED_PROP (type) != nullptr
- || TYPE_ALLOCATED_PROP (type) != nullptr)
+ if (type->dyn_prop (DYN_PROP_ASSOCIATED) != nullptr
+ || type->dyn_prop (DYN_PROP_ALLOCATED) != nullptr)
{
gdb_printf ("%*s", spaces, "");
- if (TYPE_ASSOCIATED_PROP (type) != nullptr)
+ if (type->dyn_prop (DYN_PROP_ASSOCIATED) != nullptr)
{
gdb_printf ("associated ");
- dump_dynamic_prop (*TYPE_ASSOCIATED_PROP (type));
+ dump_dynamic_prop (*type->dyn_prop (DYN_PROP_ASSOCIATED));
}
- if (TYPE_ALLOCATED_PROP (type) != nullptr)
+ if (type->dyn_prop (DYN_PROP_ALLOCATED) != nullptr)
{
- if (TYPE_ASSOCIATED_PROP (type) != nullptr)
+ if (type->dyn_prop (DYN_PROP_ASSOCIATED) != nullptr)
gdb_printf (" ");
gdb_printf ("allocated ");
- dump_dynamic_prop (*TYPE_ALLOCATED_PROP (type));
+ dump_dynamic_prop (*type->dyn_prop (DYN_PROP_ALLOCATED));
}
gdb_printf ("\n");
}
extern bool set_type_align (struct type *, ULONGEST);
/* Property accessors for the type data location. */
-#define TYPE_DATA_LOCATION(thistype) \
- ((thistype)->dyn_prop (DYN_PROP_DATA_LOCATION))
#define TYPE_DATA_LOCATION_BATON(thistype) \
- TYPE_DATA_LOCATION (thistype)->data.baton
+ ((thistype)->dyn_prop (DYN_PROP_DATA_LOCATION)->data.baton)
#define TYPE_DATA_LOCATION_ADDR(thistype) \
- (TYPE_DATA_LOCATION (thistype)->const_val ())
+ ((thistype)->dyn_prop (DYN_PROP_DATA_LOCATION)->const_val ())
#define TYPE_DATA_LOCATION_KIND(thistype) \
- (TYPE_DATA_LOCATION (thistype)->kind ())
-#define TYPE_DYNAMIC_LENGTH(thistype) \
- ((thistype)->dyn_prop (DYN_PROP_BYTE_SIZE))
-
-/* Property accessors for the type allocated/associated. */
-#define TYPE_ALLOCATED_PROP(thistype) \
- ((thistype)->dyn_prop (DYN_PROP_ALLOCATED))
-#define TYPE_ASSOCIATED_PROP(thistype) \
- ((thistype)->dyn_prop (DYN_PROP_ASSOCIATED))
-#define TYPE_RANK_PROP(thistype) \
- ((thistype)->dyn_prop (DYN_PROP_RANK))
+ ((thistype)->dyn_prop (DYN_PROP_DATA_LOCATION)->kind ())
/* C++ */
return 0;
if (m_parent != NULL)
return m_parent->address () + m_offset;
- if (NULL != TYPE_DATA_LOCATION (type ()))
+ if (NULL != type ()->dyn_prop (DYN_PROP_DATA_LOCATION))
{
- gdb_assert (TYPE_DATA_LOCATION (type ())->is_constant ());
+ gdb_assert (type ()->dyn_prop (DYN_PROP_DATA_LOCATION)->is_constant ());
return TYPE_DATA_LOCATION_ADDR (type ());
}
/* If the WHOLE value has a dynamically resolved location property then
update the address of the COMPONENT. */
type = whole->type ();
- if (NULL != TYPE_DATA_LOCATION (type)
- && TYPE_DATA_LOCATION (type)->is_constant ())
+ if (NULL != type->dyn_prop (DYN_PROP_DATA_LOCATION)
+ && type->dyn_prop (DYN_PROP_DATA_LOCATION)->is_constant ())
set_address (TYPE_DATA_LOCATION_ADDR (type));
/* Similarly, if the COMPONENT value has a dynamically resolved location
property then update its address. */
type = this->type ();
- if (NULL != TYPE_DATA_LOCATION (type)
- && TYPE_DATA_LOCATION (type)->is_constant ())
+ if (NULL != type->dyn_prop (DYN_PROP_DATA_LOCATION)
+ && type->dyn_prop (DYN_PROP_DATA_LOCATION)->is_constant ())
{
/* If the COMPONENT has a dynamic location, and is an
lval_internalvar_component, then we change it to a lval_memory.
v->set_offset (this->offset ());
v->set_embedded_offset (offset + embedded_offset () + boffset);
}
- else if (NULL != TYPE_DATA_LOCATION (type))
+ else if (NULL != type->dyn_prop (DYN_PROP_DATA_LOCATION))
{
/* Field is a dynamic data member. */
gdb_assert (0 == offset);
/* We expect an already resolved data location. */
- gdb_assert (TYPE_DATA_LOCATION (type)->is_constant ());
+ gdb_assert (type->dyn_prop (DYN_PROP_DATA_LOCATION)->is_constant ());
/* For dynamic data types defer memory allocation
until we actual access the value. */
v = value::allocate_lazy (type);
v = value::allocate_lazy (resolved_type);
else
v = value_from_contents (resolved_type, valaddr);
- if (TYPE_DATA_LOCATION (resolved_type_no_typedef) != NULL
- && TYPE_DATA_LOCATION (resolved_type_no_typedef)->is_constant ())
+ if (resolved_type_no_typedef->dyn_prop (DYN_PROP_DATA_LOCATION) != NULL
+ && resolved_type_no_typedef->dyn_prop (DYN_PROP_DATA_LOCATION)->is_constant ())
address = TYPE_DATA_LOCATION_ADDR (resolved_type_no_typedef);
v->set_lval (lval_memory);
v->set_address (address);