+2020-05-07 Simon Marchi via Gdb-patches <gdb-patches@sourceware.org>
+
+ * gdbtypes.h (struct type) <add_dyn_prop>: New method.
+ (add_dyn_prop): Remove. Update all users to use
+ type::add_dyn_prop.
+ * gdbtypes.c (add_dyn_prop): Rename to...
+ (type::add_dyn_prop): ... this.
+
2020-05-07 Simon Marchi <simon.marchi@efficios.com>
* gdbtypes.h (struct type) <get_dyn_prop>: New method.
prop.kind = PROP_VARIANT_PARTS;
prop.data.variant_parts = prop_value;
- add_dyn_prop (DYN_PROP_VARIANT_PARTS, prop, type);
+ type->add_dyn_prop (DYN_PROP_VARIANT_PARTS, prop);
}
/* Some versions of rustc emitted enums in an unusual way.
= ((gdb::array_view<variant_part> *)
obstack_copy (&objfile->objfile_obstack, &parts, sizeof (parts)));
- add_dyn_prop (DYN_PROP_VARIANT_PARTS, prop, type);
+ type->add_dyn_prop (DYN_PROP_VARIANT_PARTS, prop);
}
/* Create the vector of fields, and attach it to the type. */
struct dynamic_prop prop;
if (attr_to_dynamic_prop (attr, die, cu, &prop,
cu->per_cu->addr_type ()))
- add_dyn_prop (DYN_PROP_BYTE_SIZE, prop, type);
+ type->add_dyn_prop (DYN_PROP_BYTE_SIZE, prop);
TYPE_LENGTH (type) = 0;
}
}
{
struct type *prop_type = cu->per_cu->addr_sized_int_type (false);
if (attr_to_dynamic_prop (attr, die, cu, &prop, prop_type))
- add_dyn_prop (DYN_PROP_ALLOCATED, prop, type);
+ type->add_dyn_prop (DYN_PROP_ALLOCATED, prop);
}
else if (attr != NULL)
{
{
struct type *prop_type = cu->per_cu->addr_sized_int_type (false);
if (attr_to_dynamic_prop (attr, die, cu, &prop, prop_type))
- add_dyn_prop (DYN_PROP_ASSOCIATED, prop, type);
+ type->add_dyn_prop (DYN_PROP_ASSOCIATED, prop);
}
else if (attr != NULL)
{
attr = dwarf2_attr (die, DW_AT_data_location, cu);
if (attr_to_dynamic_prop (attr, die, cu, &prop,
cu->per_cu->addr_type ()))
- add_dyn_prop (DYN_PROP_DATA_LOCATION, prop, type);
+ type->add_dyn_prop (DYN_PROP_DATA_LOCATION, prop);
if (dwarf2_per_objfile->die_type_hash == NULL)
dwarf2_per_objfile->die_type_hash
(struct field *) TYPE_ZALLOC (result_type, sizeof (struct field));
TYPE_INDEX_TYPE (result_type) = range_type;
if (byte_stride_prop != NULL)
- add_dyn_prop (DYN_PROP_BYTE_STRIDE, *byte_stride_prop, result_type);
+ result_type->add_dyn_prop (DYN_PROP_BYTE_STRIDE, *byte_stride_prop);
else if (bit_stride > 0)
TYPE_FIELD_BITSIZE (result_type, 0) = bit_stride;
/* See gdbtypes.h */
void
-add_dyn_prop (enum dynamic_prop_node_kind prop_kind, struct dynamic_prop prop,
- struct type *type)
+type::add_dyn_prop (dynamic_prop_node_kind prop_kind, dynamic_prop prop)
{
struct dynamic_prop_list *temp;
- gdb_assert (TYPE_OBJFILE_OWNED (type));
+ gdb_assert (TYPE_OBJFILE_OWNED (this));
- temp = XOBNEW (&TYPE_OBJFILE (type)->objfile_obstack,
+ temp = XOBNEW (&TYPE_OBJFILE (this)->objfile_obstack,
struct dynamic_prop_list);
temp->prop_kind = prop_kind;
temp->prop = prop;
- temp->next = TYPE_DYN_PROP_LIST (type);
+ temp->next = TYPE_DYN_PROP_LIST (this);
- TYPE_DYN_PROP_LIST (type) = temp;
+ TYPE_DYN_PROP_LIST (this) = temp;
}
/* Remove dynamic property from TYPE in case it exists. */
list of dynamic properties. */
dynamic_prop *dyn_prop (dynamic_prop_node_kind kind) const;
+ /* * Given a dynamic property PROP of a given KIND, add this dynamic
+ property to this type.
+
+ This function assumes that this type is objfile-owned. */
+ void add_dyn_prop (dynamic_prop_node_kind kind, dynamic_prop prop);
+
/* * Type that is a pointer to this type.
NULL if no such pointer-to type is known yet.
The debugger may add the address of such a type
/* * Predicate if the type has dynamic values, which are not resolved yet. */
extern int is_dynamic_type (struct type *type);
-/* * Given a dynamic property PROP of a given KIND, add this dynamic
- property to the given TYPE.
-
- This function assumes that TYPE is objfile-owned. */
-extern void add_dyn_prop
- (enum dynamic_prop_node_kind kind, struct dynamic_prop prop,
- struct type *type);
-
extern void remove_dyn_prop (enum dynamic_prop_node_kind prop_kind,
struct type *type);