From 23dca5c3d77252ad8000d749b4457f7e286b8367 Mon Sep 17 00:00:00 2001 From: Tom Tromey Date: Tue, 29 Sep 2020 18:49:08 -0600 Subject: Add attribute::as_virtuality method This adds a new attribute::as_virtuality method and changes the DWARF reader to use it. This also ensures that the attibute's form will now be respected. gdb/ChangeLog 2020-09-29 Tom Tromey * dwarf2/read.c (dwarf2_add_field, dwarf2_add_member_fn): Update. * dwarf2/attribute.h (struct attribute) : New method. * dwarf2/attribute.c (attribute::as_virtuality): New method. --- gdb/dwarf2/read.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'gdb/dwarf2/read.c') diff --git a/gdb/dwarf2/read.c b/gdb/dwarf2/read.c index 86a7918..6653aee 100644 --- a/gdb/dwarf2/read.c +++ b/gdb/dwarf2/read.c @@ -15021,7 +15021,7 @@ dwarf2_add_field (struct field_info *fip, struct die_info *die, attr = dwarf2_attr (die, DW_AT_virtuality, cu); if (attr != nullptr) - new_field->virtuality = DW_UNSND (attr); + new_field->virtuality = attr->as_virtuality (); else new_field->virtuality = DW_VIRTUALITY_none; @@ -15722,7 +15722,7 @@ dwarf2_add_member_fn (struct field_info *fip, struct die_info *die, else { attr = dwarf2_attr (die, DW_AT_virtuality, cu); - if (attr && DW_UNSND (attr)) + if (attr != nullptr && attr->as_virtuality () != DW_VIRTUALITY_none) { /* GCC does this, as of 2008-08-25; PR debug/37237. */ complaint (_("Member function \"%s\" (offset %s) is virtual " -- cgit v1.1