]> git.ipfire.org Git - thirdparty/binutils-gdb.git/commitdiff
Simplify some symbol searches in Ada code
authorTom Tromey <tom@tromey.com>
Fri, 17 Nov 2023 01:02:14 +0000 (18:02 -0700)
committerTom Tromey <tom@tromey.com>
Sun, 28 Jan 2024 17:58:16 +0000 (10:58 -0700)
This changes some of the Ada code to simplify symbol searches.  For
example, if a function is being looked for, the search is narrowed to
use SEARCH_FUNCTION_DOMAIN rather than SEARCH_VFT.  In one spot, a
search of the "struct" domain is removed, because Ada does not have a
tag domain.

gdb/ada-exp.y
gdb/ada-lang.c
gdb/dwarf2/ada-imported.c

index 1f439b38aeae543e621726d96cb78191520f53fb..ab936ae4733932bde021dca802198cf1055d0869 100644 (file)
@@ -1404,7 +1404,7 @@ block_lookup (const struct block *context, const char *raw_name)
     }
 
   std::vector<struct block_symbol> syms
-    = ada_lookup_symbol_list (name, context, SEARCH_VFT);
+    = ada_lookup_symbol_list (name, context, SEARCH_FUNCTION_DOMAIN);
 
   if (context == NULL
       && (syms.empty () || syms[0].symbol->aclass () != LOC_BLOCK))
@@ -1483,7 +1483,7 @@ find_primitive_type (struct parser_state *par_state, const char *name)
        (char *) alloca (strlen (name) + sizeof ("standard__"));
       strcpy (expanded_name, "standard__");
       strcat (expanded_name, name);
-      sym = ada_lookup_symbol (expanded_name, NULL, SEARCH_VFT).symbol;
+      sym = ada_lookup_symbol (expanded_name, NULL, SEARCH_TYPE_DOMAIN).symbol;
       if (sym != NULL && sym->aclass () == LOC_TYPEDEF)
        type = sym->type ();
     }
index a15ea7b725e05b49f3e979452dd23ea7a036ea42..f1d01ec7aa3731eb5e9e36358d7a2304a7a73fa1 100644 (file)
@@ -7436,14 +7436,8 @@ field_alignment (struct type *type, int f)
 static struct symbol *
 ada_find_any_type_symbol (const char *name)
 {
-  struct symbol *sym;
-
-  sym = standard_lookup (name, get_selected_block (NULL), SEARCH_VFT);
-  if (sym != NULL && sym->aclass () == LOC_TYPEDEF)
-    return sym;
-
-  sym = standard_lookup (name, NULL, SEARCH_STRUCT_DOMAIN);
-  return sym;
+  return standard_lookup (name, get_selected_block (nullptr),
+                         SEARCH_TYPE_DOMAIN);
 }
 
 /* Find a type named NAME.  Ignores ambiguity.  This routine will look
index 21f81bbcdea0e648a42169ac16a6b84145e718b7..1a0bc1d528e2b59fe7f8ade829675eb1a5b02996 100644 (file)
@@ -103,7 +103,7 @@ ada_alias_get_block_value (const struct symbol *sym)
 {
   const char *name = get_imported_name (sym);
   block_symbol real_symbol = lookup_global_symbol (name, nullptr,
-                                                  SEARCH_VFT);
+                                                  SEARCH_FUNCTION_DOMAIN);
   if (real_symbol.symbol == nullptr)
     error (_("could not find alias '%s' for function '%s'"),
           name, sym->print_name ());