aboutsummaryrefslogtreecommitdiff
path: root/gdb/symtab.c
diff options
context:
space:
mode:
authorTom Tromey <tom@tromey.com>2018-11-24 09:00:42 -0700
committerTom Tromey <tom@tromey.com>2019-01-09 18:28:15 -0700
commit592553c46959c98bf5981ad245d0fbb97f373d2a (patch)
tree066ee980d8f02f73abcaea2a55d62d8a493de575 /gdb/symtab.c
parent5325b9bf1ee283c40f076334eb3ea66e1f0a6ade (diff)
downloadgdb-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/symtab.c')
-rw-r--r--gdb/symtab.c14
1 files changed, 2 insertions, 12 deletions
diff --git a/gdb/symtab.c b/gdb/symtab.c
index 8bd91bc..0cd5119 100644
--- a/gdb/symtab.c
+++ b/gdb/symtab.c
@@ -2167,7 +2167,6 @@ struct objfile *
lookup_objfile_from_block (const struct block *block)
{
struct objfile *obj;
- struct compunit_symtab *cust;
if (block == NULL)
return NULL;
@@ -2255,8 +2254,6 @@ static struct block_symbol
lookup_symbol_in_objfile_symtabs (struct objfile *objfile, int block_index,
const char *name, const domain_enum domain)
{
- struct compunit_symtab *cust;
-
gdb_assert (block_index == GLOBAL_BLOCK || block_index == STATIC_BLOCK);
if (symbol_lookup_debug > 1)
@@ -2269,7 +2266,7 @@ lookup_symbol_in_objfile_symtabs (struct objfile *objfile, int block_index,
name, domain_name (domain));
}
- ALL_OBJFILE_COMPUNITS (objfile, cust)
+ for (compunit_symtab *cust : objfile_compunits (objfile))
{
const struct blockvector *bv;
const struct block *block;
@@ -2763,12 +2760,11 @@ static struct type *
basic_lookup_transparent_type_1 (struct objfile *objfile, int block_index,
const char *name)
{
- const struct compunit_symtab *cust;
const struct blockvector *bv;
const struct block *block;
const struct symbol *sym;
- ALL_OBJFILE_COMPUNITS (objfile, cust)
+ for (compunit_symtab *cust : objfile_compunits (objfile))
{
bv = COMPUNIT_BLOCKVECTOR (cust);
block = BLOCKVECTOR_BLOCK (bv, block_index);
@@ -2874,7 +2870,6 @@ iterate_over_symbols (const struct block *block,
struct compunit_symtab *
find_pc_sect_compunit_symtab (CORE_ADDR pc, struct obj_section *section)
{
- struct compunit_symtab *cust;
struct compunit_symtab *best_cust = NULL;
struct objfile *obj_file;
CORE_ADDR distance = 0;
@@ -3349,7 +3344,6 @@ find_line_symtab (struct symtab *symtab, int line,
BEST_INDEX and BEST_LINETABLE identify the item for it. */
int best;
- struct compunit_symtab *cu;
struct symtab *s;
if (best_index >= 0)
@@ -4185,7 +4179,6 @@ output_partial_symbol_filename (const char *filename, const char *fullname,
static void
info_sources_command (const char *ignore, int from_tty)
{
- struct compunit_symtab *cu;
struct symtab *s;
struct objfile *objfile;
struct output_source_filename_data data;
@@ -4338,7 +4331,6 @@ search_symbols (const char *regexp, enum search_domain kind,
const char *t_regexp,
int nfiles, const char *files[])
{
- struct compunit_symtab *cust;
const struct blockvector *bv;
struct block *b;
int i = 0;
@@ -5202,7 +5194,6 @@ default_collect_symbol_completion_matches_break_on
won't be that many. */
struct symbol *sym;
- struct compunit_symtab *cust;
const struct block *b;
const struct block *surrounding_static_block, *surrounding_global_block;
struct block_iterator iter;
@@ -5588,7 +5579,6 @@ maybe_add_partial_symtab_filename (const char *filename, const char *fullname,
completion_list
make_source_files_completion_list (const char *text, const char *word)
{
- struct compunit_symtab *cu;
struct symtab *s;
struct objfile *objfile;
size_t text_len = strlen (text);