aboutsummaryrefslogtreecommitdiff
path: root/gdb/dwarf2/attribute.c
diff options
context:
space:
mode:
authorTom Tromey <tom@tromey.com>2020-02-08 13:40:54 -0700
committerTom Tromey <tom@tromey.com>2020-02-08 13:40:56 -0700
commitcd6c91b4f8c429d49a103c3ad45ee741e41bd835 (patch)
tree778005fe8ec6c91d7808b5b717868b535187e764 /gdb/dwarf2/attribute.c
parent162dce5526debd7fbc3a4516c37ee6178bab6e5b (diff)
downloadfsf-binutils-gdb-cd6c91b4f8c429d49a103c3ad45ee741e41bd835.zip
fsf-binutils-gdb-cd6c91b4f8c429d49a103c3ad45ee741e41bd835.tar.gz
fsf-binutils-gdb-cd6c91b4f8c429d49a103c3ad45ee741e41bd835.tar.bz2
Change some attribute functions to be methods
This changes most of the attribute-related functions to be methods. (attr_form_is_block changed in a subsequent patch.) gdb/ChangeLog 2020-02-08 Tom Tromey <tom@tromey.com> * dwarf2read.c (dwarf2_find_base_address, ) (read_call_site_scope, rust_containing_type) (dwarf2_get_pc_bounds, dwarf2_record_block_ranges) (handle_data_member_location, dwarf2_add_member_fn) (get_alignment, read_structure_type, process_structure_scope) (mark_common_block_symbol_computed, read_common_block) (read_tag_string_type, attr_to_dynamic_prop, read_subrange_type) (partial_die_info::read, read_attribute_value, new_symbol) (lookup_die_type, dwarf2_get_ref_die_offset) (dwarf2_get_attr_constant_value, follow_die_ref_or_sig) (dwarf2_fetch_die_loc_sect_off, get_DW_AT_signature_type) (dwarf2_symbol_mark_computed): Update. * dwarf2/attribute.h (struct attribute) <value_as_address, form_is_section_offset, form_is_constant, form_is_ref>: Declare methods. (value_as_address, attr_form_is_section_offset) (attr_form_is_constant, attr_form_is_ref): Don't declare. * dwarf2/attribute.c (attribute::value_as_address) (attribute::form_is_section_offset, attribute::form_is_constant) (attribute::form_is_ref): Now methods. Change-Id: I320dad13002c59b848dc86c39d5d7111c8a15bdc
Diffstat (limited to 'gdb/dwarf2/attribute.c')
-rw-r--r--gdb/dwarf2/attribute.c40
1 files changed, 20 insertions, 20 deletions
diff --git a/gdb/dwarf2/attribute.c b/gdb/dwarf2/attribute.c
index 75a2fa3..6e51fff 100644
--- a/gdb/dwarf2/attribute.c
+++ b/gdb/dwarf2/attribute.c
@@ -30,12 +30,12 @@
/* See attribute.h. */
CORE_ADDR
-attr_value_as_address (struct attribute *attr)
+attribute::value_as_address () const
{
CORE_ADDR addr;
- if (attr->form != DW_FORM_addr && attr->form != DW_FORM_addrx
- && attr->form != DW_FORM_GNU_addr_index)
+ if (form != DW_FORM_addr && form != DW_FORM_addrx
+ && form != DW_FORM_GNU_addr_index)
{
/* Aside from a few clearly defined exceptions, attributes that
contain an address must always be in DW_FORM_addr form.
@@ -49,10 +49,10 @@ attr_value_as_address (struct attribute *attr)
as well as update callers to pass in at least the CU's DWARF
version. This is more overhead than what we're willing to
expand for a pretty rare case. */
- addr = DW_UNSND (attr);
+ addr = DW_UNSND (this);
}
else
- addr = DW_ADDR (attr);
+ addr = DW_ADDR (this);
return addr;
}
@@ -72,20 +72,20 @@ attr_form_is_block (const struct attribute *attr)
/* See attribute.h. */
-int
-attr_form_is_section_offset (const struct attribute *attr)
+bool
+attribute::form_is_section_offset () const
{
- return (attr->form == DW_FORM_data4
- || attr->form == DW_FORM_data8
- || attr->form == DW_FORM_sec_offset);
+ return (form == DW_FORM_data4
+ || form == DW_FORM_data8
+ || form == DW_FORM_sec_offset);
}
/* See attribute.h. */
-int
-attr_form_is_constant (const struct attribute *attr)
+bool
+attribute::form_is_constant () const
{
- switch (attr->form)
+ switch (form)
{
case DW_FORM_sdata:
case DW_FORM_udata:
@@ -94,19 +94,19 @@ attr_form_is_constant (const struct attribute *attr)
case DW_FORM_data4:
case DW_FORM_data8:
case DW_FORM_implicit_const:
- return 1;
+ return true;
default:
- return 0;
+ return false;
}
}
/* DW_ADDR is always stored already as sect_offset; despite for the forms
besides DW_FORM_ref_addr it is stored as cu_offset in the DWARF file. */
-int
-attr_form_is_ref (const struct attribute *attr)
+bool
+attribute::form_is_ref () const
{
- switch (attr->form)
+ switch (form)
{
case DW_FORM_ref_addr:
case DW_FORM_ref1:
@@ -115,8 +115,8 @@ attr_form_is_ref (const struct attribute *attr)
case DW_FORM_ref8:
case DW_FORM_ref_udata:
case DW_FORM_GNU_ref_alt:
- return 1;
+ return true;
default:
- return 0;
+ return false;
}
}