diff options
author | Tom Tromey <tom@tromey.com> | 2018-11-24 09:00:42 -0700 |
---|---|---|
committer | Tom Tromey <tom@tromey.com> | 2019-01-09 18:28:15 -0700 |
commit | 592553c46959c98bf5981ad245d0fbb97f373d2a (patch) | |
tree | 066ee980d8f02f73abcaea2a55d62d8a493de575 /gdb/objfiles.h | |
parent | 5325b9bf1ee283c40f076334eb3ea66e1f0a6ade (diff) | |
download | gdb-592553c46959c98bf5981ad245d0fbb97f373d2a.zip gdb-592553c46959c98bf5981ad245d0fbb97f373d2a.tar.gz gdb-592553c46959c98bf5981ad245d0fbb97f373d2a.tar.bz2 |
Remove ALL_OBJFILE_COMPUNITS
This removes ALL_OBJFILE_COMPUNITS, replacing its uses with ranged for
loops. Because ALL_COMPUNITS is also updated, in some places a
declaration must be deleted to avoid shadowing.
gdb/ChangeLog
2019-01-09 Tom Tromey <tom@tromey.com>
* source.c (select_source_symtab)
(forget_cached_source_info_for_objfile): Remove declaration.
* mi/mi-cmd-file.c (mi_cmd_file_list_exec_source_files): Remove
declaration.
* maint.c (count_symtabs_and_blocks): Remove declaration.
* cp-support.c (add_symbol_overload_list_qualified): Remove
declaration.
* coffread.c (coff_symtab_read): Remove declaration.
* symtab.c (lookup_symbol_in_objfile_symtabs)
(basic_lookup_transparent_type_1): Use objfile_compunits.
(lookup_objfile_from_block, find_pc_sect_compunit_symtab)
(info_sources_command, search_symbols)
(default_collect_symbol_completion_matches_break_on)
(make_source_files_completion_list): Remove declaration.
* ada-lang.c (add_nonlocal_symbols): Use objfile_compunits.
(ada_collect_symbol_completion_matches)
(ada_add_global_exceptions): Remove declaration.
* linespec.c (iterate_over_all_matching_symtabs): Use
objfile_compunits.
* objfiles.h (ALL_OBJFILE_COMPUNITS): Remove.
(class objfile_compunits): New.
(ALL_COMPUNITS): Use objfile_compunits.
* symmisc.c (print_objfile_statistics, maintenance_info_symtabs)
(maintenance_check_symtabs, maintenance_info_line_tables): Use
objfile_compunits.
* objfiles.c (objfile_relocate1): Use objfile_compunits.
Diffstat (limited to 'gdb/objfiles.h')
-rw-r--r-- | gdb/objfiles.h | 18 |
1 files changed, 13 insertions, 5 deletions
diff --git a/gdb/objfiles.h b/gdb/objfiles.h index a3b0e92..ba6be2d 100644 --- a/gdb/objfiles.h +++ b/gdb/objfiles.h @@ -615,13 +615,21 @@ public: /* Traverse all symtabs in one objfile. */ #define ALL_OBJFILE_FILETABS(objfile, cu, s) \ - ALL_OBJFILE_COMPUNITS (objfile, cu) \ + for (compunit_symtab *cu : objfile_compunits (objfile)) \ ALL_COMPUNIT_FILETABS (cu, s) -/* Traverse all compunits in one objfile. */ +/* A range adapter that makes it possible to iterate over all + compunits in one objfile. */ + +class objfile_compunits : public next_adapter<struct compunit_symtab> +{ +public: -#define ALL_OBJFILE_COMPUNITS(objfile, cu) \ - for ((cu) = (objfile) -> compunit_symtabs; (cu) != NULL; (cu) = (cu) -> next) + explicit objfile_compunits (struct objfile *objfile) + : next_adapter<struct compunit_symtab> (objfile->compunit_symtabs) + { + } +}; /* A range adapter that makes it possible to iterate over all minimal symbols of an objfile. */ @@ -714,7 +722,7 @@ private: #define ALL_COMPUNITS(objfile, cu) \ ALL_OBJFILES (objfile) \ - ALL_OBJFILE_COMPUNITS (objfile, cu) + for (compunit_symtab *cu : objfile_compunits (objfile)) #define ALL_OBJFILE_OSECTIONS(objfile, osect) \ for (osect = objfile->sections; osect < objfile->sections_end; osect++) \ |