aboutsummaryrefslogtreecommitdiff
path: root/gdb/dwarf2/read.c
diff options
context:
space:
mode:
authorTom Tromey <tom@tromey.com>2020-09-29 18:49:08 -0600
committerTom Tromey <tom@tromey.com>2020-09-29 20:29:07 -0600
commite8e5c1585dc9df0b21ffddd7e6e9053b5512a726 (patch)
tree2cd3086e7ad4975c66caa986552493a2f9debd4a /gdb/dwarf2/read.c
parentd4df075e8b946da354dc11690a793cf5c17394aa (diff)
downloadbinutils-e8e5c1585dc9df0b21ffddd7e6e9053b5512a726.zip
binutils-e8e5c1585dc9df0b21ffddd7e6e9053b5512a726.tar.gz
binutils-e8e5c1585dc9df0b21ffddd7e6e9053b5512a726.tar.bz2
Change is_valid_DW_AT_defaulted to a method on attribute
This changes is_valid_DW_AT_defaulted to be a method on struct attribute. Now it correctly respects the form of the attribute. gdb/ChangeLog 2020-09-29 Tom Tromey <tom@tromey.com> * dwarf2/read.c (is_valid_DW_AT_defaulted): Move to attribute.c. (dwarf2_add_member_fn): Update. * dwarf2/attribute.h (struct attribute) <defaulted>: Declare. * dwarf2/attribute.c (attribute::defaulted): New method, from is_valid_DW_AT_defaulted.
Diffstat (limited to 'gdb/dwarf2/read.c')
-rw-r--r--gdb/dwarf2/read.c23
1 files changed, 2 insertions, 21 deletions
diff --git a/gdb/dwarf2/read.c b/gdb/dwarf2/read.c
index 43c9adb..86a7918 100644
--- a/gdb/dwarf2/read.c
+++ b/gdb/dwarf2/read.c
@@ -15538,25 +15538,6 @@ dwarf2_is_constructor (struct die_info *die, struct dwarf2_cu *cu)
&& (type_name[len] == '\0' || type_name[len] == '<'));
}
-/* Check if the given VALUE is a recognized enum
- dwarf_defaulted_attribute constant according to DWARF5 spec,
- Table 7.24. */
-
-static bool
-is_valid_DW_AT_defaulted (ULONGEST value)
-{
- switch (value)
- {
- case DW_DEFAULTED_no:
- case DW_DEFAULTED_in_class:
- case DW_DEFAULTED_out_of_class:
- return true;
- }
-
- complaint (_("unrecognized DW_AT_defaulted value (%s)"), pulongest (value));
- return false;
-}
-
/* Add a member function to the proper fieldlist. */
static void
@@ -15666,8 +15647,8 @@ dwarf2_add_member_fn (struct field_info *fip, struct die_info *die,
/* Check for defaulted methods. */
attr = dwarf2_attr (die, DW_AT_defaulted, cu);
- if (attr != nullptr && is_valid_DW_AT_defaulted (DW_UNSND (attr)))
- fnp->defaulted = (enum dwarf_defaulted_attribute) DW_UNSND (attr);
+ if (attr != nullptr)
+ fnp->defaulted = attr->defaulted ();
/* Check for deleted methods. */
attr = dwarf2_attr (die, DW_AT_deleted, cu);