[RFC,v2,PR,symtab/30520,2/4] gdb/symtab: reuse last segment lookup name info

Message ID 20240123170325.752251-2-dmitry.neverov@jetbrains.com
State New
Headers
Series [RFC,v2,PR,symtab/30520,1/4] gdb/symtab: check name matches before expanding a CU |

Checks

Context Check Description
linaro-tcwg-bot/tcwg_gdb_build--master-aarch64 success Testing passed
linaro-tcwg-bot/tcwg_gdb_build--master-arm success Testing passed
linaro-tcwg-bot/tcwg_gdb_check--master-arm fail Testing failed
linaro-tcwg-bot/tcwg_gdb_check--master-aarch64 fail Testing failed

Commit Message

Dmitry.Neverov Jan. 23, 2024, 5:03 p.m. UTC
  Create lookup_name_info for the last segment in a qualified name
outside the loop. The symbol_name_match_type::SEARCH_NAME is used to
avoid redundant demangling: it was already performed in
lookup_name_without_params.split_name().
---
 gdb/dwarf2/read.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)
  

Patch

diff --git a/gdb/dwarf2/read.c b/gdb/dwarf2/read.c
index b125b2e69f0..f539eb878a3 100644
--- a/gdb/dwarf2/read.c
+++ b/gdb/dwarf2/read.c
@@ -16638,6 +16638,9 @@  cooked_index_functions::expand_symtabs_matching
 	= lookup_name_without_params.split_name (lang);
       std::string last_name (name_vec.back ());
 
+      lookup_name_info last_segment_lookup_name (
+	last_name, symbol_name_match_type::SEARCH_NAME, completing, true);
+
       for (const cooked_index_entry *entry : table->find (last_name,
 							  completing))
 	{
@@ -16698,9 +16701,6 @@  cooked_index_functions::expand_symtabs_matching
 		  if (entry->lang != language_unknown)
 		    {
 		      const language_defn *lang_def = language_def (entry->lang);
-		      lookup_name_info last_segment_lookup_name (
-			last_name.data (), symbol_name_match_type::FULL,
-			false, true);
 		      symbol_name_matcher_ftype *name_matcher
 			= lang_def->get_symbol_name_matcher
 			  (last_segment_lookup_name);