[PATCH v3][PR symtab/30520 v2 2/4] gdb/symtab: reuse last segment lookup name info by creating it outside the loop

Dmitry Neverov dmitry.neverov@jetbrains.com
Wed May 8 20:22:17 GMT 2024


---
 gdb/dwarf2/read.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/gdb/dwarf2/read.c b/gdb/dwarf2/read.c
index 16b9fd34522..8da0af01d72 100644
--- a/gdb/dwarf2/read.c
+++ b/gdb/dwarf2/read.c
@@ -16643,6 +16643,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::FULL, completing, true);
+
       for (const cooked_index_entry *entry : table->find (last_name,
 							  completing))
 	{
@@ -16702,9 +16705,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));
-- 
2.40.1



More information about the Gdb-patches mailing list