+2019-05-18 Andrew Burgess <andrew.burgess@embecosm.com>
+
+ * dwarf2read.c (struct cu_partial_die_info): Add constructor,
+ delete default constructor.
+ (find_partial_die): Update to return const struct.
+ (partial_die_parent_scope): Move variable declaration into scope
+ of its use and change its type to auto.
+ (guess_partial_die_structure_name): Likewise.
+ (partial_die_info::fixup): Likewise.
+
2019-05-17 Tom Tromey <tromey@adacore.com>
* source.c (find_and_open_source): Remove cast.
struct dwarf2_cu *cu;
/* A partial_die_info. */
struct partial_die_info *pdi;
+
+ cu_partial_die_info (struct dwarf2_cu *cu, struct partial_die_info *pdi)
+ : cu (cu),
+ pdi (pdi)
+ { /* Nothhing. */ }
+
+private:
+ cu_partial_die_info () = delete;
};
-static struct cu_partial_die_info find_partial_die (sect_offset, int,
- struct dwarf2_cu *);
+static const struct cu_partial_die_info find_partial_die (sect_offset, int,
+ struct dwarf2_cu *);
static const gdb_byte *read_attribute (const struct die_reader_specs *,
struct attribute *, struct attr_abbrev *,
{
const char *grandparent_scope;
struct partial_die_info *parent, *real_pdi;
- struct cu_partial_die_info res;
/* We need to look at our parent DIE; if we have a DW_AT_specification,
then this means the parent of the specification DIE. */
real_pdi = pdi;
while (real_pdi->has_specification)
{
- res = find_partial_die (real_pdi->spec_offset,
- real_pdi->spec_is_dwz, cu);
+ auto res = find_partial_die (real_pdi->spec_offset,
+ real_pdi->spec_is_dwz, cu);
real_pdi = res.pdi;
cu = res.cu;
}
outside their CU (they do however referencing other types via
DW_FORM_ref_sig8). */
-static struct cu_partial_die_info
+static const struct cu_partial_die_info
find_partial_die (sect_offset sect_off, int offset_in_dwz, struct dwarf2_cu *cu)
{
struct dwarf2_per_objfile *dwarf2_per_objfile
struct partial_die_info *real_pdi;
struct partial_die_info *child_pdi;
- struct cu_partial_die_info res;
/* If this DIE (this DIE's specification, if any) has a parent, then
we should not do this. We'll prepend the parent's fully qualified
real_pdi = struct_pdi;
while (real_pdi->has_specification)
{
- res = find_partial_die (real_pdi->spec_offset,
- real_pdi->spec_is_dwz, cu);
+ auto res = find_partial_die (real_pdi->spec_offset,
+ real_pdi->spec_is_dwz, cu);
real_pdi = res.pdi;
cu = res.cu;
}
if (name == NULL && has_specification)
{
struct partial_die_info *spec_die;
- struct cu_partial_die_info res;
- res = find_partial_die (spec_offset, spec_is_dwz, cu);
+ auto res = find_partial_die (spec_offset, spec_is_dwz, cu);
spec_die = res.pdi;
cu = res.cu;