]> git.ipfire.org Git - thirdparty/binutils-gdb.git/commitdiff
Use gdb unordered set and map in cp-namespace.c
authorTom Tromey <tom@tromey.com>
Thu, 13 Mar 2025 22:42:53 +0000 (16:42 -0600)
committerTom Tromey <tom@tromey.com>
Tue, 18 Mar 2025 11:32:33 +0000 (05:32 -0600)
This changes cp-namespace.c to use gdb::unordered_map.

Approved-By: Simon Marchi <simon.marchi@efficios.com>
gdb/cp-namespace.c

index dc018a2ef286cf84a1b5b38f073849043037faf3..370cb368450aa5379394c8da73b9e927627c29a4 100644 (file)
@@ -32,7 +32,7 @@
 #include "language.h"
 #include "namespace.h"
 #include "inferior.h"
-#include <map>
+#include "gdbsupport/unordered_map.h"
 #include <string>
 #include <string.h>
 
@@ -352,6 +352,9 @@ cp_lookup_symbol_in_namespace (const char *the_namespace, const char *name,
   return sym;
 }
 
+/* Type used for collecting symbols.  Maps names to symbols.  */
+using symbol_map = gdb::unordered_map<std::string, block_symbol>;
+
 /* This version of the function is internal, use the wrapper unless
    the list of ambiguous symbols is needed.
 
@@ -391,8 +394,7 @@ cp_lookup_symbol_via_imports (const char *scope,
                              const int search_scope_first,
                              const int declaration_only,
                              const int search_parents,
-                             std::map<std::string,
-                                      struct block_symbol>& found_symbols)
+                             symbol_map &found_symbols)
 {
   struct block_symbol sym = {};
   int len;
@@ -509,7 +511,7 @@ cp_lookup_symbol_via_imports (const char *scope,
                              const int declaration_only,
                              const int search_parents)
 {
-  std::map<std::string, struct block_symbol> found_symbols;
+  symbol_map found_symbols;
 
   cp_lookup_symbol_via_imports(scope, name, block, domain, 0,
                               declaration_only, search_parents,