New macro ALL_BLOCK_SYMBOLS_WITH_NAME.
gdb/ChangeLog: * block.h (ALL_BLOCK_SYMBOLS_WITH_NAME): New macro. * block.c (block_lookup_symbol): Use it. * cp-support.c (make_symbol_overload_list_block): Use it. * symtab.c (iterate_over_symbols): Use it.
This commit is contained in:
parent
16b2eaa164
commit
358d6ab39c
@ -1,3 +1,10 @@
|
||||
2014-11-06 Doug Evans <xdje42@gmail.com>
|
||||
|
||||
* block.h (ALL_BLOCK_SYMBOLS_WITH_NAME): New macro.
|
||||
* block.c (block_lookup_symbol): Use it.
|
||||
* cp-support.c (make_symbol_overload_list_block): Use it.
|
||||
* symtab.c (iterate_over_symbols): Use it.
|
||||
|
||||
2014-11-06 Doug Evans <xdje42@gmail.com>
|
||||
|
||||
* symtab.c (lookup_block_symbol): Moved to ...
|
||||
|
@ -706,9 +706,7 @@ block_lookup_symbol (const struct block *block, const char *name,
|
||||
|
||||
if (!BLOCK_FUNCTION (block))
|
||||
{
|
||||
for (sym = block_iter_name_first (block, name, &iter);
|
||||
sym != NULL;
|
||||
sym = block_iter_name_next (name, &iter))
|
||||
ALL_BLOCK_SYMBOLS_WITH_NAME (block, name, iter, sym)
|
||||
{
|
||||
if (symbol_matches_domain (SYMBOL_LANGUAGE (sym),
|
||||
SYMBOL_DOMAIN (sym), domain))
|
||||
@ -726,9 +724,7 @@ block_lookup_symbol (const struct block *block, const char *name,
|
||||
|
||||
struct symbol *sym_found = NULL;
|
||||
|
||||
for (sym = block_iter_name_first (block, name, &iter);
|
||||
sym != NULL;
|
||||
sym = block_iter_name_next (name, &iter))
|
||||
ALL_BLOCK_SYMBOLS_WITH_NAME (block, name, iter, sym)
|
||||
{
|
||||
if (symbol_matches_domain (SYMBOL_LANGUAGE (sym),
|
||||
SYMBOL_DOMAIN (sym), domain))
|
||||
|
@ -286,4 +286,13 @@ extern struct symbol *block_lookup_symbol (const struct block *block,
|
||||
(sym); \
|
||||
(sym) = block_iterator_next (&(iter)))
|
||||
|
||||
/* Macro to loop through all symbols with name NAME in BLOCK,
|
||||
in no particular order. ITER helps keep track of the iteration, and
|
||||
must be a struct block_iterator. SYM points to the current symbol. */
|
||||
|
||||
#define ALL_BLOCK_SYMBOLS_WITH_NAME(block, name, iter, sym) \
|
||||
for ((sym) = block_iter_name_first ((block), (name), &(iter)); \
|
||||
(sym) != NULL; \
|
||||
(sym) = block_iter_name_next ((name), &(iter)))
|
||||
|
||||
#endif /* BLOCK_H */
|
||||
|
@ -1218,9 +1218,7 @@ make_symbol_overload_list_block (const char *name,
|
||||
struct block_iterator iter;
|
||||
struct symbol *sym;
|
||||
|
||||
for (sym = block_iter_name_first (block, name, &iter);
|
||||
sym != NULL;
|
||||
sym = block_iter_name_next (name, &iter))
|
||||
ALL_BLOCK_SYMBOLS_WITH_NAME (block, name, iter, sym)
|
||||
overload_list_add_symbol (sym, name);
|
||||
}
|
||||
|
||||
|
@ -2031,9 +2031,7 @@ iterate_over_symbols (const struct block *block, const char *name,
|
||||
struct block_iterator iter;
|
||||
struct symbol *sym;
|
||||
|
||||
for (sym = block_iter_name_first (block, name, &iter);
|
||||
sym != NULL;
|
||||
sym = block_iter_name_next (name, &iter))
|
||||
ALL_BLOCK_SYMBOLS_WITH_NAME (block, name, iter, sym)
|
||||
{
|
||||
if (symbol_matches_domain (SYMBOL_LANGUAGE (sym),
|
||||
SYMBOL_DOMAIN (sym), domain))
|
||||
|
Loading…
x
Reference in New Issue
Block a user