From: Tom Tromey Date: Fri, 26 Mar 2021 19:28:03 +0000 (-0600) Subject: Simplify psymbol_functions::expand_symtabs_matching X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=e2cd5ca40c03271aa0bf324cac1f7a66ad3904d8;p=binutils-gdb.git Simplify psymbol_functions::expand_symtabs_matching I noticed that psymbol_functions::expand_symtabs_matching calls make_ignore_params once per psymtab that is matched. This seems possibly expensive, so this patch hoists the call out of the loop. gdb/ChangeLog 2021-03-26 Tom Tromey * psymtab.c (psymbol_functions::expand_symtabs_matching): Only call make_ignore_params once. --- diff --git a/gdb/ChangeLog b/gdb/ChangeLog index 7955aa4c64e..168cd5b9c05 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,3 +1,8 @@ +2021-03-26 Tom Tromey + + * psymtab.c (psymbol_functions::expand_symtabs_matching): Only + call make_ignore_params once. + 2021-03-26 Tom Tromey * psymtab.c (psymbol_functions::expand_symtabs_matching): Remove diff --git a/gdb/psymtab.c b/gdb/psymtab.c index 5a64166d983..1ea7376a8c8 100644 --- a/gdb/psymtab.c +++ b/gdb/psymtab.c @@ -1306,6 +1306,10 @@ psymbol_functions::expand_symtabs_matching for (partial_symtab *ps : require_partial_symbols (objfile)) ps->searched_flag = PST_NOT_SEARCHED; + gdb::optional psym_lookup_name; + if (lookup_name != nullptr) + psym_lookup_name = lookup_name->make_ignore_params (); + for (partial_symtab *ps : m_partial_symtabs->range ()) { QUIT; @@ -1335,7 +1339,7 @@ psymbol_functions::expand_symtabs_matching if ((symbol_matcher == NULL && lookup_name == NULL) || recursively_search_psymtabs (ps, objfile, domain, - lookup_name->make_ignore_params (), + *psym_lookup_name, symbol_matcher)) { struct compunit_symtab *symtab =