diff options
author | Tom Tromey <tom@tromey.com> | 2018-11-24 09:20:18 -0700 |
---|---|---|
committer | Tom Tromey <tom@tromey.com> | 2019-01-09 18:28:15 -0700 |
commit | d8aeb77f040ced7d37ab83f032b2e4ded2c81ca5 (patch) | |
tree | 18324cc1d77dd8bb6cea91bfecd703746b9c71f3 /gdb/ada-lang.c | |
parent | 592553c46959c98bf5981ad245d0fbb97f373d2a (diff) | |
download | binutils-d8aeb77f040ced7d37ab83f032b2e4ded2c81ca5.zip binutils-d8aeb77f040ced7d37ab83f032b2e4ded2c81ca5.tar.gz binutils-d8aeb77f040ced7d37ab83f032b2e4ded2c81ca5.tar.bz2 |
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.
Diffstat (limited to 'gdb/ada-lang.c')
-rw-r--r-- | gdb/ada-lang.c | 100 |
1 files changed, 53 insertions, 47 deletions
diff --git a/gdb/ada-lang.c b/gdb/ada-lang.c index 69c368a..f552f13 100644 --- a/gdb/ada-lang.c +++ b/gdb/ada-lang.c @@ -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) - { - if (completion_skip_symbol (mode, sym)) - continue; + for (objfile *objfile : all_objfiles (current_program_space)) + { + 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); + } + } } } } |