aboutsummaryrefslogtreecommitdiff
path: root/gdb/gdbtypes.c
diff options
context:
space:
mode:
authorTom Tromey <tom@tromey.com>2023-04-22 12:41:43 -0600
committerTom Tromey <tom@tromey.com>2023-05-01 09:20:37 -0600
commitc819a3380fc1b110b88bc6ab5ef9323dbe7d4753 (patch)
tree05450117dff9b07e36d3ddb7bddf2fd88651c543 /gdb/gdbtypes.c
parent077a1f08485e88f3b234af1dbb8b907b16045e6a (diff)
downloadbinutils-c819a3380fc1b110b88bc6ab5ef9323dbe7d4753.zip
binutils-c819a3380fc1b110b88bc6ab5ef9323dbe7d4753.tar.gz
binutils-c819a3380fc1b110b88bc6ab5ef9323dbe7d4753.tar.bz2
Replace field_is_static with a method
This changes field_is_static to be a method on struct field, and updates all the callers. Most of this patch was written by script. Regression tested on x86-64 Fedora 36.
Diffstat (limited to 'gdb/gdbtypes.c')
-rw-r--r--gdb/gdbtypes.c20
1 files changed, 4 insertions, 16 deletions
diff --git a/gdb/gdbtypes.c b/gdb/gdbtypes.c
index c8d5314..75fd4bf 100644
--- a/gdb/gdbtypes.c
+++ b/gdb/gdbtypes.c
@@ -2113,7 +2113,7 @@ is_dynamic_type_internal (struct type *type, int top_level)
for (i = 0; i < type->num_fields (); ++i)
{
/* Static fields can be ignored here. */
- if (field_is_static (&type->field (i)))
+ if (type->field (i).is_static ())
continue;
/* If the field has dynamic type, then so does TYPE. */
if (is_dynamic_type_internal (type->field (i).type (), 0))
@@ -2461,7 +2461,7 @@ resolve_dynamic_union (struct type *type,
{
struct type *t;
- if (field_is_static (&type->field (i)))
+ if (type->field (i).is_static ())
continue;
t = resolve_dynamic_type_internal (resolved_type->field (i).type (),
@@ -2677,7 +2677,7 @@ resolve_dynamic_struct (struct type *type,
unsigned new_bit_length;
struct property_addr_info pinfo;
- if (field_is_static (&resolved_type->field (i)))
+ if (resolved_type->field (i).is_static ())
continue;
if (resolved_type->field (i).loc_kind () == FIELD_LOC_KIND_DWARF_BLOCK)
@@ -3582,7 +3582,7 @@ type_align (struct type *type)
int number_of_non_static_fields = 0;
for (unsigned i = 0; i < type->num_fields (); ++i)
{
- if (!field_is_static (&type->field (i)))
+ if (!type->field (i).is_static ())
{
number_of_non_static_fields++;
ULONGEST f_align = type_align (type->field (i).type ());
@@ -4941,18 +4941,6 @@ print_args (struct field *args, int nargs, int spaces)
}
}
-int
-field_is_static (struct field *f)
-{
- /* "static" fields are the fields whose location is not relative
- to the address of the enclosing struct. It would be nice to
- have a dedicated flag that would be set for static fields when
- the type is being created. But in practice, checking the field
- loc_kind should give us an accurate answer. */
- return (f->loc_kind () == FIELD_LOC_KIND_PHYSNAME
- || f->loc_kind () == FIELD_LOC_KIND_PHYSADDR);
-}
-
static void
dump_fn_fieldlists (struct type *type, int spaces)
{