summaryrefslogtreecommitdiff
path: root/gdb/block.h
diff options
context:
space:
mode:
authorTom Tromey <tom@tromey.com>2023-01-19 18:41:21 -0700
committerTom Tromey <tom@tromey.com>2023-02-19 12:51:06 -0700
commit81326ac076332230286e23d69978cc2698d004b9 (patch)
treec3120542cfdd4f6d797ddc145930db077076635c /gdb/block.h
parent0688bf443c618be0a4a22cbc7ffb802dd771801c (diff)
downloadbinutils-gdb-81326ac076332230286e23d69978cc2698d004b9.tar.gz
Combine both styles of block iterator
This merges the two styles of block iterator, having the initialization API decide which to use based on an optional parameter.
Diffstat (limited to 'gdb/block.h')
-rw-r--r--gdb/block.h30
1 files changed, 8 insertions, 22 deletions
diff --git a/gdb/block.h b/gdb/block.h
index 5fc41c6df02..03aeebddc6b 100644
--- a/gdb/block.h
+++ b/gdb/block.h
@@ -471,10 +471,13 @@ struct block_iterator
};
/* Initialize ITERATOR to point at the first symbol in BLOCK, and
- return that first symbol, or NULL if BLOCK is empty. */
+ return that first symbol, or NULL if BLOCK is empty. If NAME is
+ not NULL, only return symbols matching that name. */
-extern struct symbol *block_iterator_first (const struct block *block,
- struct block_iterator *iterator);
+extern struct symbol *block_iterator_first
+ (const struct block *block,
+ struct block_iterator *iterator,
+ const lookup_name_info *name = nullptr);
/* Advance ITERATOR, and return the next symbol, or NULL if there are
no more symbols. Don't call this if you've previously received
@@ -483,23 +486,6 @@ extern struct symbol *block_iterator_first (const struct block *block,
extern struct symbol *block_iterator_next (struct block_iterator *iterator);
-/* Initialize ITERATOR to point at the first symbol in BLOCK whose
- search_name () matches NAME, and return that first symbol, or
- NULL if there are no such symbols. */
-
-extern struct symbol *block_iter_match_first (const struct block *block,
- const lookup_name_info &name,
- struct block_iterator *iterator);
-
-/* Advance ITERATOR to point at the next symbol in BLOCK whose
- search_name () matches NAME, or NULL if there are no more such
- symbols. Don't call this if you've previously received NULL from
- block_iterator_match_first or block_iterator_match_next on this
- iteration. And don't call it unless ITERATOR was created by a
- previous call to block_iter_match_first. */
-
-extern struct symbol *block_iter_match_next (struct block_iterator *iterator);
-
/* Return true if symbol A is the best match possible for DOMAIN. */
extern bool best_symbol (struct symbol *a, const domain_enum domain);
@@ -574,9 +560,9 @@ extern int block_find_non_opaque_type_preferred (struct symbol *sym,
current symbol. */
#define ALL_BLOCK_SYMBOLS_WITH_NAME(block, name, iter, sym) \
- for ((sym) = block_iter_match_first ((block), (name), &(iter)); \
+ for ((sym) = block_iterator_first ((block), &(iter), &(name)); \
(sym) != NULL; \
- (sym) = block_iter_match_next (&(iter)))
+ (sym) = block_iterator_next (&(iter)))
/* Given a vector of pairs, allocate and build an obstack allocated
blockranges struct for a block. */