diff options
author | Tom Tromey <tom@tromey.com> | 2024-12-07 15:16:17 -0700 |
---|---|---|
committer | Tom Tromey <tom@tromey.com> | 2025-01-05 12:00:16 -0700 |
commit | 2cf6f57319032ad0a38fc1a5319856428b23d419 (patch) | |
tree | 795d3be7af4649902691c6c26d7516a7791fb1bc | |
parent | 64800e8954245cd32c797fb2e207a66793193bf3 (diff) | |
download | gdb-2cf6f57319032ad0a38fc1a5319856428b23d419.zip gdb-2cf6f57319032ad0a38fc1a5319856428b23d419.tar.gz gdb-2cf6f57319032ad0a38fc1a5319856428b23d419.tar.bz2 |
Some small cleanups in add_symbol_overload_list_qualified
This applies some more cleanups to add_symbol_overload_list_qualified,
consolidating calls to get_selected_block.
It also moves the symtab expansion call after the code that walks up
from the selected block, merging two loops.
-rw-r--r-- | gdb/cp-support.c | 29 |
1 files changed, 13 insertions, 16 deletions
diff --git a/gdb/cp-support.c b/gdb/cp-support.c index 91b024d..3621d68 100644 --- a/gdb/cp-support.c +++ b/gdb/cp-support.c @@ -1436,38 +1436,35 @@ static void add_symbol_overload_list_qualified (const char *func_name, std::vector<symbol *> *overload_list) { - const struct block *surrounding_static_block = 0; - - /* Look through the partial symtabs for all symbols which begin by - matching FUNC_NAME. Make sure we read that symbol table in. */ - - for (objfile *objf : current_program_space->objfiles ()) - objf->expand_symtabs_for_function (func_name); + const block *selected_block = get_selected_block (0); /* Search upwards from currently selected frame (so that we can complete on local vars. */ - for (const block *b = get_selected_block (0); - b != nullptr; - b = b->superblock ()) + for (const block *b = selected_block; b != nullptr; b = b->superblock ()) add_symbol_overload_list_block (func_name, b, overload_list); - surrounding_static_block = get_selected_block (0); - surrounding_static_block = (surrounding_static_block == nullptr - ? nullptr - : surrounding_static_block->static_block ()); + const block *surrounding_static_block = (selected_block == nullptr + ? nullptr + : selected_block->static_block ()); /* Go through the symtabs and check the externs and statics for symbols which match. */ - const block *block = get_selected_block (0); - struct objfile *current_objfile = block ? block->objfile () : nullptr; + struct objfile *current_objfile = (selected_block + ? selected_block->objfile () + : nullptr); gdbarch_iterate_over_objfiles_in_search_order (current_objfile ? current_objfile->arch () : current_inferior ()->arch (), [func_name, surrounding_static_block, &overload_list] (struct objfile *obj) { + /* Look through the partial symtabs for all symbols which + begin by matching FUNC_NAME. Make sure we read that + symbol table in. */ + obj->expand_symtabs_for_function (func_name); + for (compunit_symtab *cust : obj->compunits ()) { QUIT; |