mirror of
https://github.com/espressif/binutils-gdb.git
synced 2025-06-19 17:18:24 +08:00
gdb: add field::name / field::set_name
Add the `name` and `set_name` methods on `struct field`, in order to remove `FIELD_NAME` and `TYPE_FIELD_NAME` macros. In this patch, the macros are changed to use `field::name`, so all the call sites that are used to set the field's name are changed to use `field::set_name`. The next patch will remove the macros completely. Note that because of the name clash between the existing field named `name` and the new method, I renamed the field `m_name`. It is not private per-se, because we can't make `struct field` a non-POD yet, but it should be considered private anyway (not accessed outside `struct field`). Change-Id: If16ddbca4e0c39d0ff9da420bb5cdebe5b9b0896
This commit is contained in:
@ -135,28 +135,28 @@ build_gdb_vtable_type (struct gdbarch *arch)
|
||||
offset = 0;
|
||||
|
||||
/* ptrdiff_t vcall_and_vbase_offsets[0]; */
|
||||
FIELD_NAME (*field) = "vcall_and_vbase_offsets";
|
||||
field->set_name ("vcall_and_vbase_offsets");
|
||||
field->set_type (lookup_array_range_type (ptrdiff_type, 0, -1));
|
||||
SET_FIELD_BITPOS (*field, offset * TARGET_CHAR_BIT);
|
||||
offset += TYPE_LENGTH (field->type ());
|
||||
field++;
|
||||
|
||||
/* ptrdiff_t offset_to_top; */
|
||||
FIELD_NAME (*field) = "offset_to_top";
|
||||
field->set_name ("offset_to_top");
|
||||
field->set_type (ptrdiff_type);
|
||||
SET_FIELD_BITPOS (*field, offset * TARGET_CHAR_BIT);
|
||||
offset += TYPE_LENGTH (field->type ());
|
||||
field++;
|
||||
|
||||
/* void *type_info; */
|
||||
FIELD_NAME (*field) = "type_info";
|
||||
field->set_name ("type_info");
|
||||
field->set_type (void_ptr_type);
|
||||
SET_FIELD_BITPOS (*field, offset * TARGET_CHAR_BIT);
|
||||
offset += TYPE_LENGTH (field->type ());
|
||||
field++;
|
||||
|
||||
/* void (*virtual_functions[0]) (); */
|
||||
FIELD_NAME (*field) = "virtual_functions";
|
||||
field->set_name ("virtual_functions");
|
||||
field->set_type (lookup_array_range_type (ptr_to_void_fn_type, 0, -1));
|
||||
SET_FIELD_BITPOS (*field, offset * TARGET_CHAR_BIT);
|
||||
offset += TYPE_LENGTH (field->type ());
|
||||
@ -1036,14 +1036,14 @@ build_std_type_info_type (struct gdbarch *arch)
|
||||
offset = 0;
|
||||
|
||||
/* The vtable. */
|
||||
FIELD_NAME (*field) = "_vptr.type_info";
|
||||
field->set_name ("_vptr.type_info");
|
||||
field->set_type (void_ptr_type);
|
||||
SET_FIELD_BITPOS (*field, offset * TARGET_CHAR_BIT);
|
||||
offset += TYPE_LENGTH (field->type ());
|
||||
field++;
|
||||
|
||||
/* The name. */
|
||||
FIELD_NAME (*field) = "__name";
|
||||
field->set_name ("__name");
|
||||
field->set_type (char_ptr_type);
|
||||
SET_FIELD_BITPOS (*field, offset * TARGET_CHAR_BIT);
|
||||
offset += TYPE_LENGTH (field->type ());
|
||||
|
Reference in New Issue
Block a user