2019-01-15 Tom Tromey <tom@tromey.com>
+ * symtab.c (lookup_objfile_from_block)
+ (lookup_symbol_in_objfile_symtabs)
+ (basic_lookup_transparent_type_1, find_pc_sect_compunit_symtab)
+ (find_line_symtab, info_sources_command)
+ (default_collect_symbol_completion_matches_break_on)
+ (make_source_files_completion_list): Update.
+ * symmisc.c (print_objfile_statistics, dump_objfile)
+ (maintenance_print_symbols, maintenance_info_symtabs)
+ (maintenance_check_symtabs, maintenance_info_line_tables):
+ Update.
+ * source.c (select_source_symtab)
+ (forget_cached_source_info_for_objfile): Update.
+ * objfiles.h (class objfile_compunits): Remove.
+ (struct objfile) <compunits_range>: New typedef.
+ (compunits): New method.
+ * objfiles.c (objfile_relocate1): Update.
+ * mi/mi-cmd-file.c (mi_cmd_file_list_exec_source_files): Update.
+ * maint.c (count_symtabs_and_blocks): Update.
+ * linespec.c (iterate_over_all_matching_symtabs): Update.
+ * cp-support.c (add_symbol_overload_list_qualified): Update.
+ * coffread.c (coff_symtab_read): Update.
+ * ada-lang.c (add_nonlocal_symbols)
+ (ada_collect_symbol_completion_matches)
+ (ada_add_global_exceptions): Update.
+
+2019-01-15 Tom Tromey <tom@tromey.com>
+
* progspace.h (program_space) <objfiles_safe_range>: New
typedef.
<objfiles_safe>: New method.
symbol_name_match_type::FULL,
compare_names);
- for (compunit_symtab *cu : objfile_compunits (objfile))
+ for (compunit_symtab *cu : objfile->compunits ())
{
const struct block *global_block
= BLOCKVECTOR_BLOCK (COMPUNIT_BLOCKVECTOR (cu), GLOBAL_BLOCK);
for (objfile *objfile : current_program_space->objfiles ())
{
- for (compunit_symtab *s : objfile_compunits (objfile))
+ for (compunit_symtab *s : objfile->compunits ())
{
QUIT;
b = BLOCKVECTOR_BLOCK (COMPUNIT_BLOCKVECTOR (s), GLOBAL_BLOCK);
for (objfile *objfile : current_program_space->objfiles ())
{
- for (compunit_symtab *s : objfile_compunits (objfile))
+ for (compunit_symtab *s : objfile->compunits ())
{
QUIT;
b = BLOCKVECTOR_BLOCK (COMPUNIT_BLOCKVECTOR (s), STATIC_BLOCK);
for (objfile *objfile : current_program_space->objfiles ())
{
- for (compunit_symtab *s : objfile_compunits (objfile))
+ for (compunit_symtab *s : objfile->compunits ())
{
const struct blockvector *bv = COMPUNIT_BLOCKVECTOR (s);
int i;
/* Patch up any opaque types (references to types that are not defined
in the file where they are referenced, e.g. "struct foo *bar"). */
{
- for (compunit_symtab *cu : objfile_compunits (objfile))
+ for (compunit_symtab *cu : objfile->compunits ())
{
for (symtab *s : compunit_filetabs (cu))
patch_opaque_types (s);
for (objfile *objfile : current_program_space->objfiles ())
{
- for (compunit_symtab *cust : objfile_compunits (objfile))
+ for (compunit_symtab *cust : objfile->compunits ())
{
QUIT;
b = BLOCKVECTOR_BLOCK (COMPUNIT_BLOCKVECTOR (cust), GLOBAL_BLOCK);
for (objfile *objfile : current_program_space->objfiles ())
{
- for (compunit_symtab *cust : objfile_compunits (objfile))
+ for (compunit_symtab *cust : objfile->compunits ())
{
QUIT;
b = BLOCKVECTOR_BLOCK (COMPUNIT_BLOCKVECTOR (cust), STATIC_BLOCK);
NULL, NULL,
search_domain);
- for (compunit_symtab *cu : objfile_compunits (objfile))
+ for (compunit_symtab *cu : objfile->compunits ())
{
struct symtab *symtab = COMPUNIT_FILETABS (cu);
{
for (objfile *o : current_program_space->objfiles ())
{
- for (compunit_symtab *cu : objfile_compunits (o))
+ for (compunit_symtab *cu : o->compunits ())
{
++nr_compunit_symtabs;
nr_blocks += BLOCKVECTOR_NBLOCKS (COMPUNIT_BLOCKVECTOR (cu));
/* Look at all of the file symtabs. */
for (objfile *objfile : current_program_space->objfiles ())
{
- for (compunit_symtab *cu : objfile_compunits (objfile))
+ for (compunit_symtab *cu : objfile->compunits ())
{
for (symtab *s : compunit_filetabs (cu))
{
/* OK, get all the symtabs. */
{
- for (compunit_symtab *cust : objfile_compunits (objfile))
+ for (compunit_symtab *cust : objfile->compunits ())
{
for (symtab *s : compunit_filetabs (cust))
{
}
}
- for (compunit_symtab *cust : objfile_compunits (objfile))
+ for (compunit_symtab *cust : objfile->compunits ())
{
const struct blockvector *bv = COMPUNIT_BLOCKVECTOR (cust);
int block_line_section = COMPUNIT_BLOCK_LINE_SECTION (cust);
partial_symtabs.reset (new psymtab_storage ());
}
+ typedef next_adapter<struct compunit_symtab> compunits_range;
+
+ /* A range adapter that makes it possible to iterate over all
+ compunits in one objfile. */
+
+ compunits_range compunits ()
+ {
+ return compunits_range (compunit_symtabs);
+ }
/* All struct objfile's are chained together by their next pointers.
The program space field "objfiles" (frequently referenced via
\f
/* 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:
-
- 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. */
class objfile_msymbols
for (objfile *ofp : current_program_space->objfiles ())
{
- for (compunit_symtab *cu : objfile_compunits (ofp))
+ for (compunit_symtab *cu : ofp->compunits ())
{
for (symtab *symtab : compunit_filetabs (cu))
{
void
forget_cached_source_info_for_objfile (struct objfile *objfile)
{
- for (compunit_symtab *cu : objfile_compunits (objfile))
+ for (compunit_symtab *cu : objfile->compunits ())
{
for (symtab *s : compunit_filetabs (cu))
{
if (objfile->sf)
objfile->sf->qf->print_stats (objfile);
i = linetables = 0;
- for (compunit_symtab *cu : objfile_compunits (objfile))
+ for (compunit_symtab *cu : objfile->compunits ())
{
for (symtab *s : compunit_filetabs (cu))
{
linetables++;
}
}
- blockvectors = std::distance (objfile_compunits (objfile).begin (),
- objfile_compunits (objfile).end ());
+ blockvectors = std::distance (objfile->compunits ().begin (),
+ objfile->compunits ().end ());
printf_filtered (_(" Number of symbol tables: %d\n"), i);
printf_filtered (_(" Number of symbol tables with line tables: %d\n"),
linetables);
if (objfile->compunit_symtabs != NULL)
{
printf_filtered ("Symtabs:\n");
- for (compunit_symtab *cu : objfile_compunits (objfile))
+ for (compunit_symtab *cu : objfile->compunits ())
{
for (symtab *symtab : compunit_filetabs (cu))
{
if (!print_for_objfile)
continue;
- for (compunit_symtab *cu : objfile_compunits (objfile))
+ for (compunit_symtab *cu : objfile->compunits ())
{
for (symtab *s : compunit_filetabs (cu))
{
actually find a symtab whose name matches. */
int printed_objfile_start = 0;
- for (compunit_symtab *cust : objfile_compunits (objfile))
+ for (compunit_symtab *cust : objfile->compunits ())
{
int printed_compunit_symtab_start = 0;
actually find something worth printing. */
int printed_objfile_start = 0;
- for (compunit_symtab *cust : objfile_compunits (objfile))
+ for (compunit_symtab *cust : objfile->compunits ())
{
int found_something = 0;
struct symtab *symtab = compunit_primary_filetab (cust);
ALL_PSPACES (pspace)
for (objfile *objfile : pspace->objfiles ())
{
- for (compunit_symtab *cust : objfile_compunits (objfile))
+ for (compunit_symtab *cust : objfile->compunits ())
{
for (symtab *symtab : compunit_filetabs (cust))
{
/* Look through all blockvectors. */
for (objfile *obj : current_program_space->objfiles ())
{
- for (compunit_symtab *cust : objfile_compunits (obj))
+ for (compunit_symtab *cust : obj->compunits ())
if (block == BLOCKVECTOR_BLOCK (COMPUNIT_BLOCKVECTOR (cust),
GLOBAL_BLOCK))
{
name, domain_name (domain));
}
- for (compunit_symtab *cust : objfile_compunits (objfile))
+ for (compunit_symtab *cust : objfile->compunits ())
{
const struct blockvector *bv;
const struct block *block;
const struct block *block;
const struct symbol *sym;
- for (compunit_symtab *cust : objfile_compunits (objfile))
+ for (compunit_symtab *cust : objfile->compunits ())
{
bv = COMPUNIT_BLOCKVECTOR (cust);
block = BLOCKVECTOR_BLOCK (bv, block_index);
for (objfile *obj_file : current_program_space->objfiles ())
{
- for (compunit_symtab *cust : objfile_compunits (obj_file))
+ for (compunit_symtab *cust : obj_file->compunits ())
{
struct block *b;
const struct blockvector *bv;
for (objfile *objfile : current_program_space->objfiles ())
{
- for (compunit_symtab *cu : objfile_compunits (objfile))
+ for (compunit_symtab *cu : objfile->compunits ())
{
for (symtab *s : compunit_filetabs (cu))
{
data.first = 1;
for (objfile *objfile : current_program_space->objfiles ())
{
- for (compunit_symtab *cu : objfile_compunits (objfile))
+ for (compunit_symtab *cu : objfile->compunits ())
{
for (symtab *s : compunit_filetabs (cu))
{
for (objfile *objfile : current_program_space->objfiles ())
{
- for (compunit_symtab *cust : objfile_compunits (objfile))
+ for (compunit_symtab *cust : objfile->compunits ())
{
bv = COMPUNIT_BLOCKVECTOR (cust);
for (i = GLOBAL_BLOCK; i <= STATIC_BLOCK; i++)
/* Add completions for all currently loaded symbol tables. */
for (objfile *objfile : current_program_space->objfiles ())
{
- for (compunit_symtab *cust : objfile_compunits (objfile))
+ for (compunit_symtab *cust : objfile->compunits ())
add_symtab_completions (cust, tracker, mode, lookup_name,
sym_text, word, code);
}
for (objfile *objfile : current_program_space->objfiles ())
{
- for (compunit_symtab *cu : objfile_compunits (objfile))
+ for (compunit_symtab *cu : objfile->compunits ())
{
for (symtab *s : compunit_filetabs (cu))
{