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.
This commit is contained in:
Tom Tromey 2018-11-24 09:00:42 -07:00
parent 5325b9bf1e
commit 592553c469
12 changed files with 82 additions and 73 deletions

View file

@ -788,7 +788,6 @@ objfile_relocate1 (struct objfile *objfile,
/* OK, get all the symtabs. */
{
struct compunit_symtab *cust;
struct symtab *s;
ALL_OBJFILE_FILETABS (objfile, cust, s)
@ -806,41 +805,42 @@ objfile_relocate1 (struct objfile *objfile,
}
}
ALL_OBJFILE_COMPUNITS (objfile, cust)
{
const struct blockvector *bv = COMPUNIT_BLOCKVECTOR (cust);
int block_line_section = COMPUNIT_BLOCK_LINE_SECTION (cust);
for (compunit_symtab *cust : objfile_compunits (objfile))
{
const struct blockvector *bv = COMPUNIT_BLOCKVECTOR (cust);
int block_line_section = COMPUNIT_BLOCK_LINE_SECTION (cust);
if (BLOCKVECTOR_MAP (bv))
addrmap_relocate (BLOCKVECTOR_MAP (bv),
ANOFFSET (delta, block_line_section));
if (BLOCKVECTOR_MAP (bv))
addrmap_relocate (BLOCKVECTOR_MAP (bv),
ANOFFSET (delta, block_line_section));
for (int i = 0; i < BLOCKVECTOR_NBLOCKS (bv); ++i)
{
struct block *b;
struct symbol *sym;
struct dict_iterator iter;
for (int i = 0; i < BLOCKVECTOR_NBLOCKS (bv); ++i)
{
struct block *b;
struct symbol *sym;
struct dict_iterator iter;
b = BLOCKVECTOR_BLOCK (bv, i);
BLOCK_START (b) += ANOFFSET (delta, block_line_section);
BLOCK_END (b) += ANOFFSET (delta, block_line_section);
b = BLOCKVECTOR_BLOCK (bv, i);
BLOCK_START (b) += ANOFFSET (delta, block_line_section);
BLOCK_END (b) += ANOFFSET (delta, block_line_section);
if (BLOCK_RANGES (b) != nullptr)
for (int j = 0; j < BLOCK_NRANGES (b); j++)
if (BLOCK_RANGES (b) != nullptr)
for (int j = 0; j < BLOCK_NRANGES (b); j++)
{
BLOCK_RANGE_START (b, j)
+= ANOFFSET (delta, block_line_section);
BLOCK_RANGE_END (b, j) += ANOFFSET (delta,
block_line_section);
}
/* We only want to iterate over the local symbols, not any
symbols in included symtabs. */
ALL_DICT_SYMBOLS (BLOCK_DICT (b), iter, sym)
{
BLOCK_RANGE_START (b, j)
+= ANOFFSET (delta, block_line_section);
BLOCK_RANGE_END (b, j) += ANOFFSET (delta, block_line_section);
relocate_one_symbol (sym, objfile, delta);
}
/* We only want to iterate over the local symbols, not any
symbols in included symtabs. */
ALL_DICT_SYMBOLS (BLOCK_DICT (b), iter, sym)
{
relocate_one_symbol (sym, objfile, delta);
}
}
}
}
}
}
/* This stores relocated addresses and so must be cleared. This