Remove ALL_COMPUNITS
This removes the ALL_COMPUNITS, replacing its uses with two nested ranged for loops. gdb/ChangeLog 2019-01-09 Tom Tromey <tom@tromey.com> * symtab.c (lookup_objfile_from_block) (find_pc_sect_compunit_symtab, search_symbols) (default_collect_symbol_completion_matches_break_on): Use objfile_compunits. * objfiles.h (ALL_COMPUNITS): Remove. * maint.c (count_symtabs_and_blocks): Use objfile_compunits. * cp-support.c (add_symbol_overload_list_qualified): Use objfile_compunits. * ada-lang.c (ada_collect_symbol_completion_matches) (ada_add_global_exceptions): Use objfile_compunits.
This commit is contained in:
parent
592553c469
commit
d8aeb77f04
6 changed files with 216 additions and 189 deletions
|
@ -6465,41 +6465,46 @@ ada_collect_symbol_completion_matches (completion_tracker &tracker,
|
|||
/* Go through the symtabs and check the externs and statics for
|
||||
symbols which match. */
|
||||
|
||||
struct objfile *objfile;
|
||||
ALL_COMPUNITS (objfile, s)
|
||||
{
|
||||
QUIT;
|
||||
b = BLOCKVECTOR_BLOCK (COMPUNIT_BLOCKVECTOR (s), GLOBAL_BLOCK);
|
||||
ALL_BLOCK_SYMBOLS (b, iter, sym)
|
||||
for (objfile *objfile : all_objfiles (current_program_space))
|
||||
{
|
||||
if (completion_skip_symbol (mode, sym))
|
||||
continue;
|
||||
for (compunit_symtab *s : objfile_compunits (objfile))
|
||||
{
|
||||
QUIT;
|
||||
b = BLOCKVECTOR_BLOCK (COMPUNIT_BLOCKVECTOR (s), GLOBAL_BLOCK);
|
||||
ALL_BLOCK_SYMBOLS (b, iter, sym)
|
||||
{
|
||||
if (completion_skip_symbol (mode, sym))
|
||||
continue;
|
||||
|
||||
completion_list_add_name (tracker,
|
||||
SYMBOL_LANGUAGE (sym),
|
||||
SYMBOL_LINKAGE_NAME (sym),
|
||||
lookup_name, text, word);
|
||||
completion_list_add_name (tracker,
|
||||
SYMBOL_LANGUAGE (sym),
|
||||
SYMBOL_LINKAGE_NAME (sym),
|
||||
lookup_name, text, word);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
ALL_COMPUNITS (objfile, s)
|
||||
{
|
||||
QUIT;
|
||||
b = BLOCKVECTOR_BLOCK (COMPUNIT_BLOCKVECTOR (s), STATIC_BLOCK);
|
||||
/* Don't do this block twice. */
|
||||
if (b == surrounding_static_block)
|
||||
continue;
|
||||
ALL_BLOCK_SYMBOLS (b, iter, sym)
|
||||
for (objfile *objfile : all_objfiles (current_program_space))
|
||||
{
|
||||
if (completion_skip_symbol (mode, sym))
|
||||
continue;
|
||||
for (compunit_symtab *s : objfile_compunits (objfile))
|
||||
{
|
||||
QUIT;
|
||||
b = BLOCKVECTOR_BLOCK (COMPUNIT_BLOCKVECTOR (s), STATIC_BLOCK);
|
||||
/* Don't do this block twice. */
|
||||
if (b == surrounding_static_block)
|
||||
continue;
|
||||
ALL_BLOCK_SYMBOLS (b, iter, sym)
|
||||
{
|
||||
if (completion_skip_symbol (mode, sym))
|
||||
continue;
|
||||
|
||||
completion_list_add_name (tracker,
|
||||
SYMBOL_LANGUAGE (sym),
|
||||
SYMBOL_LINKAGE_NAME (sym),
|
||||
lookup_name, text, word);
|
||||
completion_list_add_name (tracker,
|
||||
SYMBOL_LANGUAGE (sym),
|
||||
SYMBOL_LINKAGE_NAME (sym),
|
||||
lookup_name, text, word);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/* Field Access */
|
||||
|
@ -13548,8 +13553,6 @@ static void
|
|||
ada_add_global_exceptions (compiled_regex *preg,
|
||||
std::vector<ada_exc_info> *exceptions)
|
||||
{
|
||||
struct objfile *objfile;
|
||||
|
||||
/* In Ada, the symbol "search name" is a linkage name, whereas the
|
||||
regular expression used to do the matching refers to the natural
|
||||
name. So match against the decoded name. */
|
||||
|
@ -13563,26 +13566,29 @@ ada_add_global_exceptions (compiled_regex *preg,
|
|||
NULL,
|
||||
VARIABLES_DOMAIN);
|
||||
|
||||
ALL_COMPUNITS (objfile, s)
|
||||
for (objfile *objfile : all_objfiles (current_program_space))
|
||||
{
|
||||
const struct blockvector *bv = COMPUNIT_BLOCKVECTOR (s);
|
||||
int i;
|
||||
|
||||
for (i = GLOBAL_BLOCK; i <= STATIC_BLOCK; i++)
|
||||
for (compunit_symtab *s : objfile_compunits (objfile))
|
||||
{
|
||||
struct block *b = BLOCKVECTOR_BLOCK (bv, i);
|
||||
struct block_iterator iter;
|
||||
struct symbol *sym;
|
||||
const struct blockvector *bv = COMPUNIT_BLOCKVECTOR (s);
|
||||
int i;
|
||||
|
||||
ALL_BLOCK_SYMBOLS (b, iter, sym)
|
||||
if (ada_is_non_standard_exception_sym (sym)
|
||||
&& name_matches_regex (SYMBOL_NATURAL_NAME (sym), preg))
|
||||
{
|
||||
struct ada_exc_info info
|
||||
= {SYMBOL_PRINT_NAME (sym), SYMBOL_VALUE_ADDRESS (sym)};
|
||||
for (i = GLOBAL_BLOCK; i <= STATIC_BLOCK; i++)
|
||||
{
|
||||
struct block *b = BLOCKVECTOR_BLOCK (bv, i);
|
||||
struct block_iterator iter;
|
||||
struct symbol *sym;
|
||||
|
||||
exceptions->push_back (info);
|
||||
}
|
||||
ALL_BLOCK_SYMBOLS (b, iter, sym)
|
||||
if (ada_is_non_standard_exception_sym (sym)
|
||||
&& name_matches_regex (SYMBOL_NATURAL_NAME (sym), preg))
|
||||
{
|
||||
struct ada_exc_info info
|
||||
= {SYMBOL_PRINT_NAME (sym), SYMBOL_VALUE_ADDRESS (sym)};
|
||||
|
||||
exceptions->push_back (info);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue