+2020-05-27 Tom Tromey <tromey@adacore.com>
+
+ * dwarf2/attribute.h (struct attribute) <form_is_ref>: Inline.
+ <get_ref_die_offset>: Inline.
+ <get_ref_die_offset_complaint>: New method.
+ * dwarf2/attribute.c (attribute::form_is_ref): Move to header.
+ (attribute::get_ref_die_offset_complaint): Rename from
+ get_ref_die_offset. Just issue complaint.
+
2020-05-27 Hannes Domani <ssbssa@yahoo.de>
* cli/cli-cmds.c (shell_escape): Move exit_status_set_internal_vars.
}
}
-/* 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. */
-
-bool
-attribute::form_is_ref () const
-{
- switch (form)
- {
- case DW_FORM_ref_addr:
- case DW_FORM_ref1:
- case DW_FORM_ref2:
- case DW_FORM_ref4:
- case DW_FORM_ref8:
- case DW_FORM_ref_udata:
- case DW_FORM_GNU_ref_alt:
- return true;
- default:
- return false;
- }
-}
-
/* See attribute.h. */
-sect_offset
-attribute::get_ref_die_offset () const
+void
+attribute::get_ref_die_offset_complaint () const
{
- if (form_is_ref ())
- return (sect_offset) DW_UNSND (this);
-
complaint (_("unsupported die ref attribute form: '%s'"),
dwarf_form_name (form));
- return {};
}
/* See attribute.h. */
/* 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. */
- bool form_is_ref () const;
+ bool form_is_ref () const
+ {
+ return (form == DW_FORM_ref_addr
+ || form == DW_FORM_ref1
+ || form == DW_FORM_ref2
+ || form == DW_FORM_ref4
+ || form == DW_FORM_ref8
+ || form == DW_FORM_ref_udata
+ || form == DW_FORM_GNU_ref_alt);
+ }
/* Check if the attribute's form is a DW_FORM_block*
if so return true else false. */
/* Return DIE offset of this attribute. Return 0 with complaint if
the attribute is not of the required kind. */
- sect_offset get_ref_die_offset () const;
+ sect_offset get_ref_die_offset () const
+ {
+ if (form_is_ref ())
+ return (sect_offset) u.unsnd;
+ get_ref_die_offset_complaint ();
+ return {};
+ }
/* Return the constant value held by this attribute. Return
DEFAULT_VALUE if the value held by the attribute is not
ULONGEST signature;
}
u;
+
+private:
+
+ /* Used by get_ref_die_offset to issue a complaint. */
+
+ void get_ref_die_offset_complaint () const;
};
/* Get at parts of an attribute structure. */