mirror of
https://github.com/espressif/binutils-gdb.git
synced 2025-06-27 06:17:47 +08:00
gdb: make inherit_abstract_dies use vector iterators
Small cleanup to use std::vector iterators rather than raw pointers. Approved-By: Tom Tromey <tom@tromey.com> Change-Id: I8d50dbb3f2d8dad7ff94066a578d523f1f31b590
This commit is contained in:
@ -11952,29 +11952,28 @@ inherit_abstract_dies (struct die_info *die, struct dwarf2_cu *cu)
|
|||||||
if (!offsets.empty ())
|
if (!offsets.empty ())
|
||||||
{
|
{
|
||||||
std::sort (offsets.begin (), offsets.end ());
|
std::sort (offsets.begin (), offsets.end ());
|
||||||
sect_offset *offsets_end = offsets.data () + offsets.size ();
|
|
||||||
for (sect_offset *offsetp = offsets.data () + 1;
|
for (auto offsets_it = offsets.begin () + 1;
|
||||||
offsetp < offsets_end;
|
offsets_it < offsets.end ();
|
||||||
offsetp++)
|
++offsets_it)
|
||||||
if (offsetp[-1] == *offsetp)
|
if (*(offsets_it - 1) == *offsets_it)
|
||||||
complaint (_("Multiple children of DIE %s refer "
|
complaint (_("Multiple children of DIE %s refer "
|
||||||
"to DIE %s as their abstract origin"),
|
"to DIE %s as their abstract origin"),
|
||||||
sect_offset_str (die->sect_off),
|
sect_offset_str (die->sect_off),
|
||||||
sect_offset_str (*offsetp));
|
sect_offset_str (*offsets_it));
|
||||||
}
|
}
|
||||||
|
|
||||||
sect_offset *offsetp = offsets.data ();
|
auto offsets_it = offsets.begin ();
|
||||||
sect_offset *offsets_end = offsets.data () + offsets.size ();
|
|
||||||
die_info *origin_child_die = origin_die->child;
|
die_info *origin_child_die = origin_die->child;
|
||||||
while (origin_child_die != nullptr && origin_child_die->tag != 0)
|
while (origin_child_die != nullptr && origin_child_die->tag != 0)
|
||||||
{
|
{
|
||||||
/* Is ORIGIN_CHILD_DIE referenced by any of the DIE children? */
|
/* Is ORIGIN_CHILD_DIE referenced by any of the DIE children? */
|
||||||
while (offsetp < offsets_end
|
while (offsets_it < offsets.end ()
|
||||||
&& *offsetp < origin_child_die->sect_off)
|
&& *offsets_it < origin_child_die->sect_off)
|
||||||
offsetp++;
|
++offsets_it;
|
||||||
|
|
||||||
if (offsetp >= offsets_end
|
if (offsets_it == offsets.end ()
|
||||||
|| *offsetp > origin_child_die->sect_off)
|
|| *offsets_it > origin_child_die->sect_off)
|
||||||
{
|
{
|
||||||
/* Found that ORIGIN_CHILD_DIE is really not referenced.
|
/* Found that ORIGIN_CHILD_DIE is really not referenced.
|
||||||
Check whether we're already processing ORIGIN_CHILD_DIE.
|
Check whether we're already processing ORIGIN_CHILD_DIE.
|
||||||
|
Reference in New Issue
Block a user