Revisão | 129d1afcc50c0aa3cf69fb3c5d4d8c825bec1061 (tree) |
---|---|
Hora | 2022-10-22 03:27:11 |
Autor | Simon Marchi <simon.marchi@poly...> |
Commiter | Simon Marchi |
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
@@ -11952,29 +11952,28 @@ inherit_abstract_dies (struct die_info *die, struct dwarf2_cu *cu) | ||
11952 | 11952 | if (!offsets.empty ()) |
11953 | 11953 | { |
11954 | 11954 | std::sort (offsets.begin (), offsets.end ()); |
11955 | - sect_offset *offsets_end = offsets.data () + offsets.size (); | |
11956 | - for (sect_offset *offsetp = offsets.data () + 1; | |
11957 | - offsetp < offsets_end; | |
11958 | - offsetp++) | |
11959 | - if (offsetp[-1] == *offsetp) | |
11955 | + | |
11956 | + for (auto offsets_it = offsets.begin () + 1; | |
11957 | + offsets_it < offsets.end (); | |
11958 | + ++offsets_it) | |
11959 | + if (*(offsets_it - 1) == *offsets_it) | |
11960 | 11960 | complaint (_("Multiple children of DIE %s refer " |
11961 | 11961 | "to DIE %s as their abstract origin"), |
11962 | 11962 | sect_offset_str (die->sect_off), |
11963 | - sect_offset_str (*offsetp)); | |
11963 | + sect_offset_str (*offsets_it)); | |
11964 | 11964 | } |
11965 | 11965 | |
11966 | - sect_offset *offsetp = offsets.data (); | |
11967 | - sect_offset *offsets_end = offsets.data () + offsets.size (); | |
11966 | + auto offsets_it = offsets.begin (); | |
11968 | 11967 | die_info *origin_child_die = origin_die->child; |
11969 | 11968 | while (origin_child_die != nullptr && origin_child_die->tag != 0) |
11970 | 11969 | { |
11971 | 11970 | /* Is ORIGIN_CHILD_DIE referenced by any of the DIE children? */ |
11972 | - while (offsetp < offsets_end | |
11973 | - && *offsetp < origin_child_die->sect_off) | |
11974 | - offsetp++; | |
11971 | + while (offsets_it < offsets.end () | |
11972 | + && *offsets_it < origin_child_die->sect_off) | |
11973 | + ++offsets_it; | |
11975 | 11974 | |
11976 | - if (offsetp >= offsets_end | |
11977 | - || *offsetp > origin_child_die->sect_off) | |
11975 | + if (offsets_it == offsets.end () | |
11976 | + || *offsets_it > origin_child_die->sect_off) | |
11978 | 11977 | { |
11979 | 11978 | /* Found that ORIGIN_CHILD_DIE is really not referenced. |
11980 | 11979 | Check whether we're already processing ORIGIN_CHILD_DIE. |