From 8d939e8ea4b05a263579b533850a983668ccd1fa Mon Sep 17 00:00:00 2001 From: Simon Marchi Date: Thu, 23 Sep 2021 23:35:24 -0400 Subject: [PATCH] gdb: remove FIELD_LOC_KIND macro Remove FIELD_LOC_KIND, replace its uses with field::loc_kind or call_site_target::loc_kind. Change-Id: I0368d8c3ea269d491bb215aa70e32edbdf55f389 --- gdb/dwarf2/loc.c | 2 +- gdb/gdbtypes.c | 10 +++++----- gdb/gdbtypes.h | 3 +-- 3 files changed, 7 insertions(+), 8 deletions(-) diff --git a/gdb/dwarf2/loc.c b/gdb/dwarf2/loc.c index 33f0d99f069..1054b0182e1 100644 --- a/gdb/dwarf2/loc.c +++ b/gdb/dwarf2/loc.c @@ -640,7 +640,7 @@ call_site_to_target_addr (struct gdbarch *call_site_gdbarch, struct call_site *call_site, struct frame_info *caller_frame) { - switch (FIELD_LOC_KIND (call_site->target)) + switch (call_site->target.loc_kind ()) { case FIELD_LOC_KIND_DWARF_BLOCK: { diff --git a/gdb/gdbtypes.c b/gdb/gdbtypes.c index c947215d109..622f31457f8 100644 --- a/gdb/gdbtypes.c +++ b/gdb/gdbtypes.c @@ -4204,11 +4204,11 @@ check_types_equal (struct type *type1, struct type *type2, if (FIELD_ARTIFICIAL (*field1) != FIELD_ARTIFICIAL (*field2) || FIELD_BITSIZE (*field1) != FIELD_BITSIZE (*field2) - || FIELD_LOC_KIND (*field1) != FIELD_LOC_KIND (*field2)) + || field1->loc_kind () != field2->loc_kind ()) return false; if (!compare_maybe_null_strings (field1->name (), field2->name ())) return false; - switch (FIELD_LOC_KIND (*field1)) + switch (field1->loc_kind ()) { case FIELD_LOC_KIND_BITPOS: if (FIELD_BITPOS (*field1) != FIELD_BITPOS (*field2)) @@ -4245,7 +4245,7 @@ check_types_equal (struct type *type1, struct type *type2, default: internal_error (__FILE__, __LINE__, _("Unsupported field kind " "%d by check_types_equal"), - FIELD_LOC_KIND (*field1)); + field1->loc_kind ()); } worklist->emplace_back (field1->type (), field2->type ()); @@ -4891,8 +4891,8 @@ field_is_static (struct field *f) 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 (FIELD_LOC_KIND (*f) == FIELD_LOC_KIND_PHYSNAME - || FIELD_LOC_KIND (*f) == FIELD_LOC_KIND_PHYSADDR); + return (f->loc_kind () == FIELD_LOC_KIND_PHYSNAME + || f->loc_kind () == FIELD_LOC_KIND_PHYSADDR); } static void diff --git a/gdb/gdbtypes.h b/gdb/gdbtypes.h index f36a7532d67..f1c8d434446 100644 --- a/gdb/gdbtypes.h +++ b/gdb/gdbtypes.h @@ -2125,7 +2125,6 @@ extern void set_type_vptr_basetype (struct type *, struct type *); (TYPE_CPLUS_SPECIFIC(thistype)->virtual_field_bits == NULL ? 0 \ : B_TST(TYPE_CPLUS_SPECIFIC(thistype)->virtual_field_bits, (index))) -#define FIELD_LOC_KIND(thisfld) ((thisfld).loc_kind ()) #define FIELD_BITPOS(thisfld) ((thisfld).loc_bitpos ()) #define FIELD_ENUMVAL(thisfld) ((thisfld).loc_enumval ()) #define FIELD_STATIC_PHYSNAME(thisfld) ((thisfld).loc_physname ()) @@ -2134,7 +2133,7 @@ extern void set_type_vptr_basetype (struct type *, struct type *); #define FIELD_ARTIFICIAL(thisfld) ((thisfld).artificial) #define FIELD_BITSIZE(thisfld) ((thisfld).bitsize) -#define TYPE_FIELD_LOC_KIND(thistype, n) FIELD_LOC_KIND ((thistype)->field (n)) +#define TYPE_FIELD_LOC_KIND(thistype, n) ((thistype)->field (n).loc_kind ()) #define TYPE_FIELD_BITPOS(thistype, n) FIELD_BITPOS ((thistype)->field (n)) #define TYPE_FIELD_ENUMVAL(thistype, n) FIELD_ENUMVAL ((thistype)->field (n)) #define TYPE_FIELD_STATIC_PHYSNAME(thistype, n) FIELD_STATIC_PHYSNAME ((thistype)->field (n)) -- 2.30.2