diff options
author | Tom Tromey <tromey@adacore.com> | 2024-05-23 09:35:46 -0600 |
---|---|---|
committer | Tom Tromey <tromey@adacore.com> | 2024-06-14 10:56:37 -0600 |
commit | 67554fb777bfd676355e254f37ba5d9524c07824 (patch) | |
tree | 1b60fb5ad89b0d9a4d6f51906b8f356d30f8f000 /gdb | |
parent | 5ae8852d26a835715889b0ccad75d5d18572d302 (diff) | |
download | gdb-67554fb777bfd676355e254f37ba5d9524c07824.zip gdb-67554fb777bfd676355e254f37ba5d9524c07824.tar.gz gdb-67554fb777bfd676355e254f37ba5d9524c07824.tar.bz2 |
Simplify lookup_local_symbol
This simplifies lookup_local_symbol a little, by having it check
whether the current block is the static or global block, instead of
first searching for the static block.
Diffstat (limited to 'gdb')
-rw-r--r-- | gdb/symtab.c | 11 |
1 files changed, 3 insertions, 8 deletions
diff --git a/gdb/symtab.c b/gdb/symtab.c index bd0ace4..c9629ce 100644 --- a/gdb/symtab.c +++ b/gdb/symtab.c @@ -2222,17 +2222,12 @@ lookup_local_symbol (const char *name, if (block == nullptr) return {}; - struct symbol *sym; - const struct block *static_block = block->static_block (); const char *scope = block->scope (); - /* Check if it's a global block. */ - if (static_block == nullptr) - return {}; - - while (block != static_block) + while (!block->is_global_block () && !block->is_static_block ()) { - sym = lookup_symbol_in_block (name, match_type, block, domain); + struct symbol *sym = lookup_symbol_in_block (name, match_type, + block, domain); if (sym != NULL) return (struct block_symbol) {sym, block}; |