diff --git a/gdb/ada-exp.y b/gdb/ada-exp.y
index 3280a483a5e..df7a85f101d 100644
--- a/gdb/ada-exp.y
+++ b/gdb/ada-exp.y
@@ -1265,7 +1265,7 @@ write_object_renaming (struct parser_state *par_state,
 
   name = obstack_strndup (&temp_parse_space, renamed_entity,
 			  renamed_entity_len);
-  ada_lookup_encoded_symbol (name, orig_left_context, VAR_DOMAIN, &sym_info);
+  ada_lookup_encoded_symbol (name, orig_left_context, SEARCH_VFT, &sym_info);
   if (sym_info.symbol == NULL)
     error (_("Could not find renamed variable: %s"), ada_decode (name).c_str ());
   else if (sym_info.symbol->aclass () == LOC_TYPEDEF)
@@ -1334,7 +1334,7 @@ write_object_renaming (struct parser_state *par_state,
 	    renaming_expr = end;
 
 	    ada_lookup_encoded_symbol (index_name, orig_left_context,
-				       VAR_DOMAIN, &index_sym_info);
+				       SEARCH_VFT, &index_sym_info);
 	    if (index_sym_info.symbol == NULL)
 	      error (_("Could not find %s"), index_name);
 	    else if (index_sym_info.symbol->aclass () == LOC_TYPEDEF)
@@ -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, VAR_DOMAIN);
+    = ada_lookup_symbol_list (name, context, SEARCH_VFT);
 
   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, VAR_DOMAIN).symbol;
+      sym = ada_lookup_symbol (expanded_name, NULL, SEARCH_VFT).symbol;
       if (sym != NULL && sym->aclass () == LOC_TYPEDEF)
 	type = sym->type ();
     }
@@ -1670,7 +1670,8 @@ write_var_or_type (struct parser_state *par_state,
 	  encoded_name[tail_index] = terminator;
 
 	  std::vector<struct block_symbol> syms
-	    = ada_lookup_symbol_list (decoded_name.c_str (), block, VAR_DOMAIN);
+	    = ada_lookup_symbol_list (decoded_name.c_str (), block,
+				      SEARCH_VFT);
 
 	  type_sym = select_possible_type_sym (syms);
 
@@ -1876,7 +1877,7 @@ write_name_assoc (struct parser_state *par_state, struct stoken name)
       std::vector<struct block_symbol> syms
 	= ada_lookup_symbol_list (name.ptr,
 				  par_state->expression_context_block,
-				  VAR_DOMAIN);
+				  SEARCH_VFT);
 
       if (syms.size () != 1 || syms[0].symbol->aclass () == LOC_TYPEDEF)
 	pstate->push_new<ada_string_operation> (copy_name (name));
diff --git a/gdb/ada-lang.c b/gdb/ada-lang.c
index eac688cd632..36192dc07c6 100644
--- a/gdb/ada-lang.c
+++ b/gdb/ada-lang.c
@@ -98,12 +98,12 @@ static struct value *make_array_descriptor (struct type *, struct value *);
 static void ada_add_block_symbols (std::vector<struct block_symbol> &,
 				   const struct block *,
 				   const lookup_name_info &lookup_name,
-				   domain_enum, struct objfile *);
+				   domain_search_flags, struct objfile *);
 
 static void ada_add_all_symbols (std::vector<struct block_symbol> &,
 				 const struct block *,
 				 const lookup_name_info &lookup_name,
-				 domain_enum, int, int *);
+				 domain_search_flags, int, int *);
 
 static int is_nonfunction (const std::vector<struct block_symbol> &);
 
@@ -176,9 +176,6 @@ static LONGEST pos_atr (struct value *);
 
 static struct value *val_atr (struct type *, LONGEST);
 
-static struct symbol *standard_lookup (const char *, const struct block *,
-				       domain_enum);
-
 static struct value *ada_search_struct_field (const char *, struct value *, int,
 					      struct type *);
 
@@ -335,7 +332,7 @@ struct cache_entry
   /* The name used to perform the lookup.  */
   std::string name;
   /* The namespace used during the lookup.  */
-  domain_enum domain = UNDEF_DOMAIN;
+  domain_search_flags domain = 0;
   /* The symbol returned by the lookup, or NULL if no matching symbol
      was found.  */
   struct symbol *sym = nullptr;
@@ -349,7 +346,7 @@ struct cache_entry
 struct cache_entry_search
 {
   const char *name;
-  domain_enum domain;
+  domain_search_flags domain;
 
   hashval_t hash () const
   {
@@ -3751,7 +3748,7 @@ ada_find_operator_symbol (enum exp_opcode op, bool parse_completion,
     {
       std::vector<struct block_symbol> candidates
 	= ada_lookup_symbol_list (ada_decoded_op_name (op),
-				  NULL, VAR_DOMAIN);
+				  NULL, SEARCH_VFT);
 
       int i = ada_resolve_function (candidates, argvec,
 				    nargs, ada_decoded_op_name (op), NULL,
@@ -3772,7 +3769,7 @@ ada_resolve_funcall (struct symbol *sym, const struct block *block,
 		     innermost_block_tracker *tracker)
 {
   std::vector<struct block_symbol> candidates
-    = ada_lookup_symbol_list (sym->linkage_name (), block, VAR_DOMAIN);
+    = ada_lookup_symbol_list (sym->linkage_name (), block, SEARCH_VFT);
 
   int i;
   if (candidates.size () == 1)
@@ -3838,7 +3835,7 @@ ada_resolve_variable (struct symbol *sym, const struct block *block,
 		      innermost_block_tracker *tracker)
 {
   std::vector<struct block_symbol> candidates
-    = ada_lookup_symbol_list (sym->linkage_name (), block, VAR_DOMAIN);
+    = ada_lookup_symbol_list (sym->linkage_name (), block, SEARCH_VFT);
 
   if (std::any_of (candidates.begin (),
 		   candidates.end (),
@@ -4685,7 +4682,7 @@ ada_clear_symbol_cache (program_space *pspace)
    SYM.  Same principle for BLOCK if not NULL.  */
 
 static int
-lookup_cached_symbol (const char *name, domain_enum domain,
+lookup_cached_symbol (const char *name, domain_search_flags domain,
 		      struct symbol **sym, const struct block **block)
 {
   htab_t tab = get_ada_pspace_data (current_program_space);
@@ -4708,8 +4705,8 @@ lookup_cached_symbol (const char *name, domain_enum domain,
    in domain DOMAIN, save this result in our symbol cache.  */
 
 static void
-cache_symbol (const char *name, domain_enum domain, struct symbol *sym,
-	      const struct block *block)
+cache_symbol (const char *name, domain_search_flags domain,
+	      struct symbol *sym, const struct block *block)
 {
   /* Symbols for builtin types don't have a block.
      For now don't cache such symbols.  */
@@ -4766,7 +4763,7 @@ name_match_type_from_name (const char *lookup_name)
 
 static struct symbol *
 standard_lookup (const char *name, const struct block *block,
-		 domain_enum domain)
+		 domain_search_flags domain)
 {
   /* Initialize it just to avoid a GCC false warning.  */
   struct block_symbol sym = {};
@@ -5169,7 +5166,7 @@ is_package_name (const char *name)
 
   /* If it is a function that has not been defined at library level,
      then we should be able to look it up in the symbols.  */
-  if (standard_lookup (name, NULL, VAR_DOMAIN) != NULL)
+  if (standard_lookup (name, NULL, SEARCH_VFT) != NULL)
     return 0;
 
   /* Library-level function names start with "_ada_".  See if function
@@ -5182,7 +5179,7 @@ is_package_name (const char *name)
 
   std::string fun_name = string_printf ("_ada_%s", name);
 
-  return (standard_lookup (fun_name.c_str (), NULL, VAR_DOMAIN) == NULL);
+  return (standard_lookup (fun_name.c_str (), NULL, SEARCH_VFT) == NULL);
 }
 
 /* Return nonzero if SYM corresponds to a renaming entity that is
@@ -5342,7 +5339,7 @@ remove_irrelevant_renamings (std::vector<struct block_symbol> *syms,
 static void
 ada_add_local_symbols (std::vector<struct block_symbol> &result,
 		       const lookup_name_info &lookup_name,
-		       const struct block *block, domain_enum domain)
+		       const struct block *block, domain_search_flags domain)
 {
   while (block != NULL)
     {
@@ -5416,7 +5413,7 @@ static int
 ada_add_block_renamings (std::vector<struct block_symbol> &result,
 			 const struct block *block,
 			 const lookup_name_info &lookup_name,
-			 domain_enum domain)
+			 domain_search_flags domain)
 {
   struct using_direct *renaming;
   int defns_mark = result.size ();
@@ -5567,7 +5564,7 @@ static void
 map_matching_symbols (struct objfile *objfile,
 		      const lookup_name_info &lookup_name,
 		      bool is_wild_match,
-		      domain_enum domain,
+		      domain_search_flags domain,
 		      int global,
 		      match_data &data)
 {
@@ -5594,7 +5591,7 @@ map_matching_symbols (struct objfile *objfile,
 static void
 add_nonlocal_symbols (std::vector<struct block_symbol> &result,
 		      const lookup_name_info &lookup_name,
-		      domain_enum domain, int global)
+		      domain_search_flags domain, int global)
 {
   struct match_data data (&result);
 
@@ -5648,7 +5645,7 @@ static void
 ada_add_all_symbols (std::vector<struct block_symbol> &result,
 		     const struct block *block,
 		     const lookup_name_info &lookup_name,
-		     domain_enum domain,
+		     domain_search_flags domain,
 		     int full_search,
 		     int *made_global_lookup_p)
 {
@@ -5728,7 +5725,7 @@ ada_add_all_symbols (std::vector<struct block_symbol> &result,
 static std::vector<struct block_symbol>
 ada_lookup_symbol_list_worker (const lookup_name_info &lookup_name,
 			       const struct block *block,
-			       domain_enum domain,
+			       domain_search_flags domain,
 			       int full_search)
 {
   int syms_from_global_search;
@@ -5757,7 +5754,7 @@ ada_lookup_symbol_list_worker (const lookup_name_info &lookup_name,
 
 std::vector<struct block_symbol>
 ada_lookup_symbol_list (const char *name, const struct block *block,
-			domain_enum domain)
+			domain_search_flags domain)
 {
   symbol_name_match_type name_match_type = name_match_type_from_name (name);
   lookup_name_info lookup_name (name, name_match_type);
@@ -5774,7 +5771,7 @@ ada_lookup_symbol_list (const char *name, const struct block *block,
 
 void
 ada_lookup_encoded_symbol (const char *name, const struct block *block,
-			   domain_enum domain,
+			   domain_search_flags domain,
 			   struct block_symbol *info)
 {
   /* Since we already have an encoded name, wrap it in '<>' to force a
@@ -5796,7 +5793,7 @@ ada_lookup_encoded_symbol (const char *name, const struct block *block,
 
 struct block_symbol
 ada_lookup_symbol (const char *name, const struct block *block0,
-		   domain_enum domain)
+		   domain_search_flags domain)
 {
   std::vector<struct block_symbol> candidates
     = ada_lookup_symbol_list (name, block0, domain);
@@ -6068,7 +6065,7 @@ static void
 ada_add_block_symbols (std::vector<struct block_symbol> &result,
 		       const struct block *block,
 		       const lookup_name_info &lookup_name,
-		       domain_enum domain, struct objfile *objfile)
+		       domain_search_flags domain, struct objfile *objfile)
 {
   /* A matching argument symbol, if any.  */
   struct symbol *arg_sym;
@@ -7501,11 +7498,11 @@ ada_find_any_type_symbol (const char *name)
 {
   struct symbol *sym;
 
-  sym = standard_lookup (name, get_selected_block (NULL), VAR_DOMAIN);
+  sym = standard_lookup (name, get_selected_block (NULL), SEARCH_VFT);
   if (sym != NULL && sym->aclass () == LOC_TYPEDEF)
     return sym;
 
-  sym = standard_lookup (name, NULL, STRUCT_DOMAIN);
+  sym = standard_lookup (name, NULL, SEARCH_STRUCT_DOMAIN);
   return sym;
 }
 
@@ -11383,7 +11380,7 @@ get_var_value (const char *name, const char *err_msg)
   std::vector<struct block_symbol> syms
     = ada_lookup_symbol_list_worker (lookup_name,
 				     get_selected_block (0),
-				     VAR_DOMAIN, 1);
+				     SEARCH_VFT, 1);
 
   if (syms.size () != 1)
     {
@@ -11686,7 +11683,7 @@ ada_has_this_exception_support (const struct exception_support_info *einfo)
      that should be compiled with debugging information.  As a result, we
      expect to find that symbol in the symtabs.  */
 
-  sym = standard_lookup (einfo->catch_exception_sym, NULL, VAR_DOMAIN);
+  sym = standard_lookup (einfo->catch_exception_sym, NULL, SEARCH_VFT);
   if (sym == NULL)
     {
       /* Perhaps we did not find our symbol because the Ada runtime was
@@ -11720,7 +11717,7 @@ ada_has_this_exception_support (const struct exception_support_info *einfo)
     error (_("Symbol \"%s\" is not a function (class = %d)"),
 	   sym->linkage_name (), sym->aclass ());
 
-  sym = standard_lookup (einfo->catch_handlers_sym, NULL, VAR_DOMAIN);
+  sym = standard_lookup (einfo->catch_handlers_sym, NULL, SEARCH_VFT);
   if (sym == NULL)
     {
       struct bound_minimal_symbol msym
@@ -12687,7 +12684,7 @@ ada_exception_sal (enum ada_exception_catchpoint_kind ex)
   /* Then lookup the function on which we will break in order to catch
      the Ada exceptions requested by the user.  */
   sym_name = ada_exception_sym_name (ex);
-  sym = standard_lookup (sym_name, NULL, VAR_DOMAIN);
+  sym = standard_lookup (sym_name, NULL, SEARCH_VFT);
 
   if (sym == NULL)
     throw_error (NOT_FOUND_ERROR, _("Catchpoint symbol not found: %s"),
@@ -13505,7 +13502,7 @@ class ada_language : public language_defn
 
   bool iterate_over_symbols
 	(const struct block *block, const lookup_name_info &name,
-	 domain_enum domain,
+	 domain_search_flags domain,
 	 gdb::function_view<symbol_found_callback_ftype> callback) const override
   {
     std::vector<struct block_symbol> results
@@ -13742,11 +13739,15 @@ class ada_language : public language_defn
   {
     struct block_symbol sym;
 
+    domain_search_flags flags = to_search_flags (domain);
+    if (domain == VAR_DOMAIN)
+      flags |= SEARCH_TYPE_DOMAIN | SEARCH_FUNCTION_DOMAIN;
+
     sym = ada_lookup_symbol (name,
 			     (block == nullptr
 			      ? nullptr
 			      : block->static_block ()),
-			     domain);
+			     flags);
     if (sym.symbol != NULL)
       return sym;
 
diff --git a/gdb/ada-lang.h b/gdb/ada-lang.h
index 9eb9326a86c..698d5b9f91a 100644
--- a/gdb/ada-lang.h
+++ b/gdb/ada-lang.h
@@ -222,14 +222,14 @@ extern std::string ada_decode (const char *name, bool wrap = true,
 			       bool operators = true);
 
 extern std::vector<struct block_symbol> ada_lookup_symbol_list
-     (const char *, const struct block *, domain_enum);
+     (const char *, const struct block *, domain_search_flags);
 
 extern struct block_symbol ada_lookup_symbol (const char *,
 					      const struct block *,
-					      domain_enum);
+					      domain_search_flags);
 
 extern void ada_lookup_encoded_symbol
-  (const char *name, const struct block *block, domain_enum domain,
+  (const char *name, const struct block *block, domain_search_flags domain,
    struct block_symbol *symbol_info);
 
 extern struct bound_minimal_symbol ada_lookup_simple_minsym (const char *,
diff --git a/gdb/dwarf2/cooked-index.h b/gdb/dwarf2/cooked-index.h
index b3d5b5cd6f6..3b49f468be6 100644
--- a/gdb/dwarf2/cooked-index.h
+++ b/gdb/dwarf2/cooked-index.h
@@ -105,28 +105,6 @@ struct cooked_index_entry : public allocate_on_obstack
     return false;
   }
 
-  /* Return true if this entry matches DOMAIN.  */
-  bool matches (domain_enum domain) const
-  {
-    /* Just reject type declarations.  */
-    if ((flags & IS_TYPE_DECLARATION) != 0)
-      return false;
-
-    switch (domain)
-      {
-      case LABEL_DOMAIN:
-	return false;
-
-      case MODULE_DOMAIN:
-	return tag == DW_TAG_module;
-
-      case COMMON_BLOCK_DOMAIN:
-	return tag == DW_TAG_common_block;
-      }
-
-    return true;
-  }
-
   /* Return true if this entry matches KIND.  */
   bool matches (domain_search_flags kind) const;
 
diff --git a/gdb/dwarf2/read-debug-names.c b/gdb/dwarf2/read-debug-names.c
index 743cee6c46d..da1b0e9229b 100644
--- a/gdb/dwarf2/read-debug-names.c
+++ b/gdb/dwarf2/read-debug-names.c
@@ -87,7 +87,7 @@ struct dwarf2_debug_names_index : public dwarf2_base_index_functions
   void expand_matching_symbols
     (struct objfile *,
      const lookup_name_info &lookup_name,
-     domain_enum domain,
+     domain_search_flags domain,
      int global,
      symbol_compare_ftype *ordered_compare) override;
 
@@ -98,8 +98,7 @@ struct dwarf2_debug_names_index : public dwarf2_base_index_functions
      gdb::function_view<expand_symtabs_symbol_matcher_ftype> symbol_matcher,
      gdb::function_view<expand_symtabs_exp_notify_ftype> expansion_notify,
      block_search_flags search_flags,
-     domain_enum domain,
-     domain_search_flags kind) override;
+     domain_search_flags domain) override;
 };
 
 quick_symbol_functions_up
@@ -536,28 +535,27 @@ class dw2_debug_names_iterator
 public:
   dw2_debug_names_iterator (const mapped_debug_names &map,
 			    block_search_flags block_index,
-			    domain_enum domain,
+			    domain_search_flags domain,
 			    const char *name, dwarf2_per_objfile *per_objfile)
-    : m_map (map), m_block_index (block_index), m_domain (domain),
+    : m_map (map), m_block_index (block_index), m_search (domain),
       m_addr (find_vec_in_debug_names (map, name, per_objfile)),
       m_per_objfile (per_objfile)
   {}
 
   dw2_debug_names_iterator (const mapped_debug_names &map,
 			    domain_search_flags search, uint32_t namei,
-			    dwarf2_per_objfile *per_objfile,
-			    domain_enum domain = UNDEF_DOMAIN)
+			    dwarf2_per_objfile *per_objfile)
     : m_map (map),
-      m_domain (domain),
       m_search (search),
       m_addr (find_vec_in_debug_names (map, namei, per_objfile)),
       m_per_objfile (per_objfile)
   {}
 
   dw2_debug_names_iterator (const mapped_debug_names &map,
-			    block_search_flags block_index, domain_enum domain,
+			    block_search_flags block_index,
+			    domain_search_flags domain,
 			    uint32_t namei, dwarf2_per_objfile *per_objfile)
-    : m_map (map), m_block_index (block_index), m_domain (domain),
+    : m_map (map), m_block_index (block_index), m_search (domain),
       m_addr (find_vec_in_debug_names (map, namei, per_objfile)),
       m_per_objfile (per_objfile)
   {}
@@ -581,7 +579,6 @@ class dw2_debug_names_iterator
 				      | SEARCH_STATIC_BLOCK);
 
   /* The kind of symbol we're looking for.  */
-  const domain_enum m_domain = UNDEF_DOMAIN;
   const domain_search_flags m_search = SEARCH_ALL;
 
   /* The list of CUs from the index entry of the symbol, or NULL if
@@ -880,12 +877,6 @@ dw2_debug_names_iterator::next ()
       break;
     }
 
-  if (! (m_domain == domain
-	 || (m_domain == VAR_DOMAIN
-	     && (domain == TYPE_DOMAIN
-		 || domain == FUNCTION_DOMAIN))))
-    goto again;
-
   domain_search_flags flags = to_search_flags (domain);
   if ((flags & m_search) == 0)
     goto again;
@@ -906,7 +897,7 @@ dwarf2_debug_names_index::dump (struct objfile *objfile)
 void
 dwarf2_debug_names_index::expand_matching_symbols
   (struct objfile *objfile,
-   const lookup_name_info &name, domain_enum domain,
+   const lookup_name_info &name, domain_search_flags domain,
    int global,
    symbol_compare_ftype *ordered_compare)
 {
@@ -950,8 +941,7 @@ dwarf2_debug_names_index::expand_symtabs_matching
    gdb::function_view<expand_symtabs_symbol_matcher_ftype> symbol_matcher,
    gdb::function_view<expand_symtabs_exp_notify_ftype> expansion_notify,
    block_search_flags search_flags,
-   domain_enum domain,
-   domain_search_flags kind)
+   domain_search_flags domain)
 {
   dwarf2_per_objfile *per_objfile = get_dwarf2_per_objfile (objfile);
 
@@ -985,7 +975,7 @@ dwarf2_debug_names_index::expand_symtabs_matching
     {
       /* The name was matched, now expand corresponding CUs that were
 	 marked.  */
-      dw2_debug_names_iterator iter (map, kind, namei, per_objfile, domain);
+      dw2_debug_names_iterator iter (map, domain, namei, per_objfile);
 
       struct dwarf2_per_cu_data *per_cu;
       while ((per_cu = iter.next ()) != NULL)
diff --git a/gdb/dwarf2/read-gdb-index.c b/gdb/dwarf2/read-gdb-index.c
index eeb52203ef9..a45c0f1a730 100644
--- a/gdb/dwarf2/read-gdb-index.c
+++ b/gdb/dwarf2/read-gdb-index.c
@@ -142,7 +142,7 @@ struct dwarf2_gdb_index : public dwarf2_base_index_functions
   void expand_matching_symbols
     (struct objfile *,
      const lookup_name_info &lookup_name,
-     domain_enum domain,
+     domain_search_flags domain,
      int global,
      symbol_compare_ftype *ordered_compare) override;
 
@@ -153,8 +153,7 @@ struct dwarf2_gdb_index : public dwarf2_base_index_functions
      gdb::function_view<expand_symtabs_symbol_matcher_ftype> symbol_matcher,
      gdb::function_view<expand_symtabs_exp_notify_ftype> expansion_notify,
      block_search_flags search_flags,
-     domain_enum domain,
-     domain_search_flags kind) override;
+     domain_search_flags domain) override;
 };
 
 /* This dumps minimal information about the index.
@@ -183,7 +182,7 @@ struct dw2_symtab_iterator
      GLOBAL_BLOCK and STATIC_BLOCK.  */
   gdb::optional<block_enum> block_index;
   /* The kind of symbol we're looking for.  */
-  domain_enum domain;
+  domain_search_flags domain;
   /* The list of CUs from the index entry of the symbol,
      or NULL if not found.  */
   offset_view vec;
@@ -204,7 +203,7 @@ static void
 dw2_symtab_iter_init (struct dw2_symtab_iterator *iter,
 		      dwarf2_per_objfile *per_objfile,
 		      gdb::optional<block_enum> block_index,
-		      domain_enum domain, offset_type namei,
+		      domain_search_flags domain, offset_type namei,
 		      mapped_gdb_index &index)
 {
   iter->per_objfile = per_objfile;
@@ -320,7 +319,7 @@ dw2_symtab_iter_next (struct dw2_symtab_iterator *iter,
 void
 dwarf2_gdb_index::expand_matching_symbols
   (struct objfile *objfile,
-   const lookup_name_info &name, domain_enum domain,
+   const lookup_name_info &name, domain_search_flags domain,
    int global,
    symbol_compare_ftype *ordered_compare)
 {
@@ -462,8 +461,7 @@ dwarf2_gdb_index::expand_symtabs_matching
      gdb::function_view<expand_symtabs_symbol_matcher_ftype> symbol_matcher,
      gdb::function_view<expand_symtabs_exp_notify_ftype> expansion_notify,
      block_search_flags search_flags,
-     domain_enum domain,
-     domain_search_flags kind)
+     domain_search_flags domain)
 {
   dwarf2_per_objfile *per_objfile = get_dwarf2_per_objfile (objfile);
 
@@ -496,7 +494,7 @@ dwarf2_gdb_index::expand_symtabs_matching
 					  [&] (offset_type idx)
     {
       if (!dw2_expand_marked_cus (per_objfile, idx, file_matcher,
-				  expansion_notify, search_flags, kind))
+				  expansion_notify, search_flags, domain))
 	return false;
       return true;
     }, per_objfile);
diff --git a/gdb/dwarf2/read.c b/gdb/dwarf2/read.c
index 866c00e75a2..35f65bddc3f 100644
--- a/gdb/dwarf2/read.c
+++ b/gdb/dwarf2/read.c
@@ -1638,7 +1638,7 @@ struct readnow_functions : public dwarf2_base_index_functions
   void expand_matching_symbols
     (struct objfile *,
      const lookup_name_info &lookup_name,
-     domain_enum domain,
+     domain_search_flags domain,
      int global,
      symbol_compare_ftype *ordered_compare) override
   {
@@ -1651,8 +1651,7 @@ struct readnow_functions : public dwarf2_base_index_functions
      gdb::function_view<expand_symtabs_symbol_matcher_ftype> symbol_matcher,
      gdb::function_view<expand_symtabs_exp_notify_ftype> expansion_notify,
      block_search_flags search_flags,
-     domain_enum domain,
-     domain_search_flags kind) override
+     domain_search_flags domain) override
   {
     return true;
   }
@@ -16578,7 +16577,7 @@ struct cooked_index_functions : public dwarf2_base_index_functions
   void expand_matching_symbols
     (struct objfile *,
      const lookup_name_info &lookup_name,
-     domain_enum domain,
+     domain_search_flags domain,
      int global,
      symbol_compare_ftype *ordered_compare) override;
 
@@ -16589,8 +16588,7 @@ struct cooked_index_functions : public dwarf2_base_index_functions
      gdb::function_view<expand_symtabs_symbol_matcher_ftype> symbol_matcher,
      gdb::function_view<expand_symtabs_exp_notify_ftype> expansion_notify,
      block_search_flags search_flags,
-     domain_enum domain,
-     domain_search_flags kind) override;
+     domain_search_flags domain) override;
 
   bool can_lazily_read_symbols () override
   {
@@ -16605,12 +16603,14 @@ struct cooked_index_functions : public dwarf2_base_index_functions
 
   enum language lookup_global_symbol_language (struct objfile *objfile,
 					       const char *name,
-					       domain_enum domain,
+					       domain_search_flags domain,
 					       bool *symbol_found_p) override
   {
     *symbol_found_p = false;
 
-    if (!(domain == VAR_DOMAIN && streq (name, "main")))
+    if ((domain & SEARCH_FUNCTION_DOMAIN) == 0)
+      return language_unknown;
+    if (!streq (name, "main"))
       return language_unknown;
 
     dwarf2_per_objfile *per_objfile = get_dwarf2_per_objfile (objfile);
@@ -16682,7 +16682,7 @@ void
 cooked_index_functions::expand_matching_symbols
      (struct objfile *objfile,
       const lookup_name_info &lookup_name,
-      domain_enum domain,
+      domain_search_flags domain,
       int global,
       symbol_compare_ftype *ordered_compare)
 {
@@ -16724,8 +16724,7 @@ cooked_index_functions::expand_symtabs_matching
       gdb::function_view<expand_symtabs_symbol_matcher_ftype> symbol_matcher,
       gdb::function_view<expand_symtabs_exp_notify_ftype> expansion_notify,
       block_search_flags search_flags,
-      domain_enum domain,
-      domain_search_flags kind)
+      domain_search_flags domain)
 {
   dwarf2_per_objfile *per_objfile = get_dwarf2_per_objfile (objfile);
 
@@ -16794,8 +16793,7 @@ cooked_index_functions::expand_symtabs_matching
 
 	  /* See if the symbol matches the type filter.  */
 	  if (!entry->matches (search_flags)
-	      || !entry->matches (domain)
-	      || !entry->matches (kind))
+	      || !entry->matches (domain))
 	    continue;
 
 	  /* We've found the base name of the symbol; now walk its
diff --git a/gdb/dwarf2/read.h b/gdb/dwarf2/read.h
index da907729320..e7a7466f05c 100644
--- a/gdb/dwarf2/read.h
+++ b/gdb/dwarf2/read.h
@@ -862,7 +862,7 @@ struct dwarf2_base_index_functions : public quick_symbol_functions
 
   enum language lookup_global_symbol_language (struct objfile *objfile,
 					       const char *name,
-					       domain_enum domain,
+					       domain_search_flags domain,
 					       bool *symbol_found_p) override
   {
     *symbol_found_p = false;
diff --git a/gdb/language.h b/gdb/language.h
index 6ee8f6160e1..b633b3dfa39 100644
--- a/gdb/language.h
+++ b/gdb/language.h
@@ -369,7 +369,7 @@ struct language_defn
      used as the definition.  */
   virtual bool iterate_over_symbols
 	(const struct block *block, const lookup_name_info &name,
-	 domain_enum domain,
+	 domain_search_flags domain,
 	 gdb::function_view<symbol_found_callback_ftype> callback) const
   {
     return ::iterate_over_symbols (block, name, domain, callback);
diff --git a/gdb/linespec.c b/gdb/linespec.c
index 7aabedf239d..8ec9192fb37 100644
--- a/gdb/linespec.c
+++ b/gdb/linespec.c
@@ -350,7 +350,7 @@ struct linespec_parser
 
 static void iterate_over_file_blocks
   (struct symtab *symtab, const lookup_name_info &name,
-   domain_enum domain,
+   domain_search_flags domain,
    gdb::function_view<symbol_found_callback_ftype> callback);
 
 static void initialize_defaults (struct symtab **default_symtab,
@@ -1154,8 +1154,7 @@ static void
 iterate_over_all_matching_symtabs
   (struct linespec_state *state,
    const lookup_name_info &lookup_name,
-   const domain_enum name_domain,
-   domain_search_flags domain_search_flags,
+   const domain_search_flags domain,
    struct program_space *search_pspace, bool include_inline,
    gdb::function_view<symbol_found_callback_ftype> callback)
 {
@@ -1173,15 +1172,13 @@ iterate_over_all_matching_symtabs
 	  objfile->expand_symtabs_matching (NULL, &lookup_name, NULL, NULL,
 					    (SEARCH_GLOBAL_BLOCK
 					     | SEARCH_STATIC_BLOCK),
-					    UNDEF_DOMAIN,
-					    domain_search_flags);
+					    domain);
 
 	  for (compunit_symtab *cu : objfile->compunits ())
 	    {
 	      struct symtab *symtab = cu->primary_filetab ();
 
-	      iterate_over_file_blocks (symtab, lookup_name, name_domain,
-					callback);
+	      iterate_over_file_blocks (symtab, lookup_name, domain, callback);
 
 	      if (include_inline)
 		{
@@ -1193,7 +1190,7 @@ iterate_over_all_matching_symtabs
 		    {
 		      block = bv->block (i);
 		      state->language->iterate_over_symbols
-			(block, lookup_name, name_domain,
+			(block, lookup_name, domain,
 			 [&] (block_symbol *bsym)
 			 {
 			   /* Restrict calls to CALLBACK to symbols
@@ -1226,7 +1223,8 @@ get_current_search_block (void)
 static void
 iterate_over_file_blocks
   (struct symtab *symtab, const lookup_name_info &name,
-   domain_enum domain, gdb::function_view<symbol_found_callback_ftype> callback)
+   domain_search_flags domain,
+   gdb::function_view<symbol_found_callback_ftype> callback)
 {
   const struct block *block;
 
@@ -3442,10 +3440,10 @@ lookup_prefix_sym (struct linespec_state *state,
       if (elt == nullptr)
 	{
 	  iterate_over_all_matching_symtabs (state, lookup_name,
-					     STRUCT_DOMAIN, SEARCH_ALL,
+					     SEARCH_STRUCT_DOMAIN,
 					     NULL, false, collector);
 	  iterate_over_all_matching_symtabs (state, lookup_name,
-					     VAR_DOMAIN, SEARCH_ALL,
+					     SEARCH_VFT,
 					     NULL, false, collector);
 	}
       else
@@ -3456,8 +3454,12 @@ lookup_prefix_sym (struct linespec_state *state,
 
 	  gdb_assert (!pspace->executing_startup);
 	  set_current_program_space (pspace);
-	  iterate_over_file_blocks (elt, lookup_name, STRUCT_DOMAIN, collector);
-	  iterate_over_file_blocks (elt, lookup_name, VAR_DOMAIN, collector);
+	  iterate_over_file_blocks (elt, lookup_name,
+				    SEARCH_STRUCT_DOMAIN,
+				    collector);
+	  iterate_over_file_blocks (elt, lookup_name,
+				    SEARCH_VFT,
+				    collector);
 	}
     }
 
@@ -3791,12 +3793,16 @@ find_function_symbols (struct linespec_state *state,
 
   /* Try NAME as an Objective-C selector.  */
   find_imps (name, &symbol_names);
+
+  domain_search_flags flags = SEARCH_FUNCTION_DOMAIN;
+  if (state->list_mode)
+    flags = SEARCH_VFT;
+
   if (!symbol_names.empty ())
     add_all_symbol_names_from_pspace (&info, state->search_pspace,
-				      symbol_names, SEARCH_FUNCTION_DOMAIN);
+				      symbol_names, flags);
   else
-    add_matching_symbols_to_info (name, name_match_type,
-				  SEARCH_FUNCTION_DOMAIN,
+    add_matching_symbols_to_info (name, name_match_type, flags,
 				  &info, state->search_pspace);
 }
 
@@ -4322,7 +4328,7 @@ add_matching_symbols_to_info (const char *name,
       if (elt == nullptr)
 	{
 	  iterate_over_all_matching_symtabs (info->state, lookup_name,
-					     VAR_DOMAIN, domain_search_flags,
+					     domain_search_flags,
 					     pspace, true,
 					     [&] (block_symbol *bsym)
 	    { return info->add_symbol (bsym); });
@@ -4337,7 +4343,7 @@ add_matching_symbols_to_info (const char *name,
 	  program_space *elt_pspace = elt->compunit ()->objfile ()->pspace;
 	  gdb_assert (!elt_pspace->executing_startup);
 	  set_current_program_space (elt_pspace);
-	  iterate_over_file_blocks (elt, lookup_name, VAR_DOMAIN,
+	  iterate_over_file_blocks (elt, lookup_name, SEARCH_VFT,
 				    [&] (block_symbol *bsym)
 	    { return info->add_symbol (bsym); });
 
diff --git a/gdb/objfiles.h b/gdb/objfiles.h
index 0da44a38c7f..d5a7ab4b70e 100644
--- a/gdb/objfiles.h
+++ b/gdb/objfiles.h
@@ -586,7 +586,7 @@ struct objfile
 
   /* See quick_symbol_functions.  */
   void expand_matching_symbols
-    (const lookup_name_info &name, domain_enum domain,
+    (const lookup_name_info &name, domain_search_flags domain,
      int global,
      symbol_compare_ftype *ordered_compare);
 
@@ -597,8 +597,7 @@ struct objfile
      gdb::function_view<expand_symtabs_symbol_matcher_ftype> symbol_matcher,
      gdb::function_view<expand_symtabs_exp_notify_ftype> expansion_notify,
      block_search_flags search_flags,
-     domain_enum domain,
-     domain_search_flags kind);
+     domain_search_flags domain);
 
   /* See quick_symbol_functions.  */
   struct compunit_symtab *find_pc_sect_compunit_symtab
@@ -616,7 +615,7 @@ struct objfile
 
   /* See quick_symbol_functions.  */
   enum language lookup_global_symbol_language (const char *name,
-					       domain_enum domain,
+					       domain_search_flags domain,
 					       bool *symbol_found_p);
 
   /* See quick_symbol_functions.  */
diff --git a/gdb/psymtab.c b/gdb/psymtab.c
index dc960b661ea..49912c4bd41 100644
--- a/gdb/psymtab.c
+++ b/gdb/psymtab.c
@@ -42,7 +42,7 @@ static struct partial_symbol *lookup_partial_symbol (struct objfile *,
 						     struct partial_symtab *,
 						     const lookup_name_info &,
 						     int,
-						     domain_enum);
+						     domain_search_flags);
 
 static const char *psymtab_to_fullname (struct partial_symtab *ps);
 
@@ -280,7 +280,7 @@ find_pc_sect_psymbol (struct objfile *objfile,
 enum language
 psymbol_functions::lookup_global_symbol_language (struct objfile *objfile,
 						  const char *name,
-						  domain_enum domain,
+						  domain_search_flags domain,
 						  bool *symbol_found_p)
 {
   *symbol_found_p = false;
@@ -329,7 +329,8 @@ psymbol_name_matches (partial_symbol *psym,
 static struct partial_symbol *
 match_partial_symbol (struct objfile *objfile,
 		      struct partial_symtab *pst, int global,
-		      const lookup_name_info &name, domain_enum domain,
+		      const lookup_name_info &name,
+		      domain_search_flags domain,
 		      symbol_compare_ftype *ordered_compare)
 {
   struct partial_symbol **start, **psym;
@@ -378,8 +379,7 @@ match_partial_symbol (struct objfile *objfile,
       while (top <= real_top
 	     && psymbol_name_matches (*top, name))
 	{
-	  if (symbol_matches_domain ((*top)->ginfo.language (),
-				     (*top)->domain, domain))
+	  if (search_flags_matches (domain, (*top)->domain))
 	    return *top;
 	  top++;
 	}
@@ -392,8 +392,7 @@ match_partial_symbol (struct objfile *objfile,
     {
       for (psym = start; psym < start + length; psym++)
 	{
-	  if (symbol_matches_domain ((*psym)->ginfo.language (),
-				     (*psym)->domain, domain)
+	  if (search_flags_matches (domain, (*psym)->domain)
 	      && psymbol_name_matches (*psym, name))
 	    return *psym;
 	}
@@ -410,7 +409,7 @@ static struct partial_symbol *
 lookup_partial_symbol (struct objfile *objfile,
 		       struct partial_symtab *pst,
 		       const lookup_name_info &lookup_name,
-		       int global, domain_enum domain)
+		       int global, domain_search_flags domain)
 {
   struct partial_symbol **start, **psym;
   struct partial_symbol **top, **real_top, **bottom, **center;
@@ -470,8 +469,7 @@ lookup_partial_symbol (struct objfile *objfile,
       while (top <= real_top && symbol_matches_search_name (&(*top)->ginfo,
 							    lookup_name))
 	{
-	  if (symbol_matches_domain ((*top)->ginfo.language (),
-				     (*top)->domain, domain))
+	  if (search_flags_matches (domain, (*top)->domain))
 	    return *top;
 	  top++;
 	}
@@ -484,8 +482,7 @@ lookup_partial_symbol (struct objfile *objfile,
     {
       for (psym = start; psym < start + length; psym++)
 	{
-	  if (symbol_matches_domain ((*psym)->ginfo.language (),
-				     (*psym)->domain, domain)
+	  if (search_flags_matches (domain, (*psym)->domain)
 	      && symbol_matches_search_name (&(*psym)->ginfo, lookup_name))
 	    return *psym;
 	}
@@ -883,7 +880,7 @@ psymtab_to_fullname (struct partial_symtab *ps)
 void
 psymbol_functions::expand_matching_symbols
   (struct objfile *objfile,
-   const lookup_name_info &name, domain_enum domain,
+   const lookup_name_info &name, domain_search_flags domain,
    int global,
    symbol_compare_ftype *ordered_compare)
 {
@@ -907,8 +904,7 @@ recursively_search_psymtabs
   (struct partial_symtab *ps,
    struct objfile *objfile,
    block_search_flags search_flags,
-   domain_enum domain,
-   domain_search_flags search,
+   domain_search_flags domain,
    const lookup_name_info &lookup_name,
    gdb::function_view<expand_symtabs_symbol_matcher_ftype> sym_matcher)
 {
@@ -930,7 +926,7 @@ recursively_search_psymtabs
 	continue;
 
       r = recursively_search_psymtabs (ps->dependencies[i],
-				       objfile, search_flags, domain, search,
+				       objfile, search_flags, domain,
 				       lookup_name, sym_matcher);
       if (r != 0)
 	{
@@ -978,19 +974,7 @@ recursively_search_psymtabs
 	{
 	  QUIT;
 
-	  if ((domain == UNDEF_DOMAIN
-	       || symbol_matches_domain ((*psym)->ginfo.language (),
-					 (*psym)->domain, domain))
-	      && (search == SEARCH_ALL
-		  || (search == SEARCH_MODULE_DOMAIN
-		      && (*psym)->domain == MODULE_DOMAIN)
-		  || (search == SEARCH_VAR_DOMAIN
-		      && (*psym)->aclass != LOC_TYPEDEF
-		      && (*psym)->aclass != LOC_BLOCK)
-		  || (search == SEARCH_FUNCTION_DOMAIN
-		      && (*psym)->aclass == LOC_BLOCK)
-		  || (search == SEARCH_TYPE_DOMAIN
-		      && (*psym)->aclass == LOC_TYPEDEF))
+	  if (search_flags_matches (domain, (*psym)->domain)
 	      && psymbol_name_matches (*psym, lookup_name)
 	      && (sym_matcher == NULL
 		  || sym_matcher ((*psym)->ginfo.search_name ())))
@@ -1018,8 +1002,7 @@ psymbol_functions::expand_symtabs_matching
    gdb::function_view<expand_symtabs_symbol_matcher_ftype> symbol_matcher,
    gdb::function_view<expand_symtabs_exp_notify_ftype> expansion_notify,
    block_search_flags search_flags,
-   domain_enum domain,
-   domain_search_flags search)
+   domain_search_flags domain)
 {
   /* Clear the search flags.  */
   for (partial_symtab *ps : partial_symbols (objfile))
@@ -1061,8 +1044,7 @@ psymbol_functions::expand_symtabs_matching
 
       if (lookup_name == nullptr
 	  || recursively_search_psymtabs (ps, objfile, search_flags,
-					  domain, search,
-					  *psym_lookup_name,
+					  domain, *psym_lookup_name,
 					  symbol_matcher))
 	{
 	  compunit_symtab *cust = psymtab_to_symtab (objfile, ps);
diff --git a/gdb/psymtab.h b/gdb/psymtab.h
index 43e6244fd6e..25214ca4ba1 100644
--- a/gdb/psymtab.h
+++ b/gdb/psymtab.h
@@ -617,7 +617,7 @@ struct psymbol_functions : public quick_symbol_functions
 
   enum language lookup_global_symbol_language (struct objfile *objfile,
 					       const char *name,
-					       domain_enum domain,
+					       domain_search_flags domain,
 					       bool *symbol_found_p) override;
 
   void print_stats (struct objfile *objfile, bool print_bcache) override;
@@ -629,7 +629,7 @@ struct psymbol_functions : public quick_symbol_functions
   void expand_matching_symbols
     (struct objfile *,
      const lookup_name_info &lookup_name,
-     domain_enum domain,
+     domain_search_flags domain,
      int global,
      symbol_compare_ftype *ordered_compare) override;
 
@@ -640,7 +640,6 @@ struct psymbol_functions : public quick_symbol_functions
      gdb::function_view<expand_symtabs_symbol_matcher_ftype> symbol_matcher,
      gdb::function_view<expand_symtabs_exp_notify_ftype> expansion_notify,
      block_search_flags search_flags,
-     domain_enum domain,
      domain_search_flags kind) override;
 
   struct compunit_symtab *find_pc_sect_compunit_symtab
diff --git a/gdb/quick-symbol.h b/gdb/quick-symbol.h
index 1eac8f25035..8fe7414c4b3 100644
--- a/gdb/quick-symbol.h
+++ b/gdb/quick-symbol.h
@@ -101,14 +101,14 @@ struct quick_symbol_functions
 
   /* Check to see if the global symbol is defined in a "partial" symbol table
      of OBJFILE. NAME is the name of the symbol to look for.  DOMAIN
-     indicates what sort of symbol to search for.
+     indicates what sorts of symbols to search for.
 
      If found, sets *symbol_found_p to true and returns the symbol language.
      defined, or NULL if no such symbol table exists.  */
   virtual enum language lookup_global_symbol_language
        (struct objfile *objfile,
 	const char *name,
-	domain_enum domain,
+	domain_search_flags domain,
 	bool *symbol_found_p) = 0;
 
   /* Print statistics about any indices loaded for OBJFILE.  The
@@ -143,7 +143,7 @@ struct quick_symbol_functions
   virtual void expand_matching_symbols
     (struct objfile *,
      const lookup_name_info &lookup_name,
-     domain_enum domain,
+     domain_search_flags domain,
      int global,
      symbol_compare_ftype *ordered_compare) = 0;
 
@@ -161,8 +161,7 @@ struct quick_symbol_functions
 
      Otherwise, individual symbols are considered.
 
-     If DOMAIN or KIND do not match, the symbol is skipped.
-     If DOMAIN is UNDEF_DOMAIN, that is treated as a wildcard.
+     If DOMAIN does not match, the symbol is skipped.
 
      If the symbol name does not match LOOKUP_NAME, the symbol is skipped.
 
@@ -182,8 +181,7 @@ struct quick_symbol_functions
      gdb::function_view<expand_symtabs_symbol_matcher_ftype> symbol_matcher,
      gdb::function_view<expand_symtabs_exp_notify_ftype> expansion_notify,
      block_search_flags search_flags,
-     domain_enum domain,
-     domain_search_flags kind) = 0;
+     domain_search_flags domain) = 0;
 
   /* Return the comp unit from OBJFILE that contains PC and
      SECTION.  Return NULL if there is no such compunit.  This
diff --git a/gdb/symfile-debug.c b/gdb/symfile-debug.c
index 8fbacef9d30..a4da8ec28d7 100644
--- a/gdb/symfile-debug.c
+++ b/gdb/symfile-debug.c
@@ -226,7 +226,6 @@ objfile::map_symtabs_matching_filename
 					  on_expansion,
 					  (SEARCH_GLOBAL_BLOCK
 					   | SEARCH_STATIC_BLOCK),
-					  UNDEF_DOMAIN,
 					  SEARCH_ALL))
 	{
 	  retval = false;
@@ -282,6 +281,10 @@ objfile::lookup_symbol (block_enum kind, const char *name, domain_enum domain)
     return true;
   };
 
+  domain_search_flags flags = to_search_flags (domain);
+  if (domain == VAR_DOMAIN)
+    flags |= SEARCH_TYPE_DOMAIN | SEARCH_FUNCTION_DOMAIN;
+
   for (const auto &iter : qf_require_partial_symbols ())
     {
       if (!iter->expand_symtabs_matching (this,
@@ -292,8 +295,7 @@ objfile::lookup_symbol (block_enum kind, const char *name, domain_enum domain)
 					  kind == GLOBAL_BLOCK
 					  ? SEARCH_GLOBAL_BLOCK
 					  : SEARCH_STATIC_BLOCK,
-					  domain,
-					  SEARCH_ALL))
+					  flags))
 	break;
     }
 
@@ -347,8 +349,7 @@ objfile::expand_symtabs_for_function (const char *func_name)
 				   nullptr,
 				   (SEARCH_GLOBAL_BLOCK
 				    | SEARCH_STATIC_BLOCK),
-				   VAR_DOMAIN,
-				   SEARCH_ALL);
+				   SEARCH_VFT);
 }
 
 void
@@ -384,13 +385,12 @@ objfile::expand_symtabs_with_fullname (const char *fullname)
 				   nullptr,
 				   (SEARCH_GLOBAL_BLOCK
 				    | SEARCH_STATIC_BLOCK),
-				   UNDEF_DOMAIN,
 				   SEARCH_ALL);
 }
 
 void
 objfile::expand_matching_symbols
-  (const lookup_name_info &name, domain_enum domain,
+  (const lookup_name_info &name, domain_search_flags domain,
    int global,
    symbol_compare_ftype *ordered_compare)
 {
@@ -398,7 +398,7 @@ objfile::expand_matching_symbols
     gdb_printf (gdb_stdlog,
 		"qf->expand_matching_symbols (%s, %s, %d, %s)\n",
 		objfile_debug_name (this),
-		domain_name (domain), global,
+		domain_name (domain).c_str (), global,
 		host_address_to_string (ordered_compare));
 
   for (const auto &iter : qf_require_partial_symbols ())
@@ -413,8 +413,7 @@ objfile::expand_symtabs_matching
    gdb::function_view<expand_symtabs_symbol_matcher_ftype> symbol_matcher,
    gdb::function_view<expand_symtabs_exp_notify_ftype> expansion_notify,
    block_search_flags search_flags,
-   domain_enum domain,
-   domain_search_flags kind)
+   domain_search_flags domain)
 {
   /* This invariant is documented in quick-functions.h.  */
   gdb_assert (lookup_name != nullptr || symbol_matcher == nullptr);
@@ -426,12 +425,12 @@ objfile::expand_symtabs_matching
 		host_address_to_string (&file_matcher),
 		host_address_to_string (&symbol_matcher),
 		host_address_to_string (&expansion_notify),
-		domain_name (kind).c_str ());
+		domain_name (domain).c_str ());
 
   for (const auto &iter : qf_require_partial_symbols ())
     if (!iter->expand_symtabs_matching (this, file_matcher, lookup_name,
 					symbol_matcher, expansion_notify,
-					search_flags, domain, kind))
+					search_flags, domain))
       return false;
   return true;
 }
@@ -514,7 +513,7 @@ objfile::find_compunit_symtab_by_address (CORE_ADDR address)
 
 enum language
 objfile::lookup_global_symbol_language (const char *name,
-					domain_enum domain,
+					domain_search_flags domain,
 					bool *symbol_found_p)
 {
   enum language result = language_unknown;
diff --git a/gdb/symfile.c b/gdb/symfile.c
index b21ba73c69d..7147f292535 100644
--- a/gdb/symfile.c
+++ b/gdb/symfile.c
@@ -3763,7 +3763,7 @@ expand_symtabs_matching
    gdb::function_view<expand_symtabs_symbol_matcher_ftype> symbol_matcher,
    gdb::function_view<expand_symtabs_exp_notify_ftype> expansion_notify,
    block_search_flags search_flags,
-   domain_search_flags kind)
+   domain_search_flags domain)
 {
   for (objfile *objfile : current_program_space->objfiles ())
     if (!objfile->expand_symtabs_matching (file_matcher,
@@ -3771,8 +3771,7 @@ expand_symtabs_matching
 					   symbol_matcher,
 					   expansion_notify,
 					   search_flags,
-					   UNDEF_DOMAIN,
-					   kind))
+					   domain))
       return false;
   return true;
 }
diff --git a/gdb/symmisc.c b/gdb/symmisc.c
index 8f620bb7ebe..51b134cf219 100644
--- a/gdb/symmisc.c
+++ b/gdb/symmisc.c
@@ -919,7 +919,6 @@ maintenance_expand_symtabs (const char *args, int from_tty)
 	 NULL,
 	 NULL,
 	 SEARCH_GLOBAL_BLOCK | SEARCH_STATIC_BLOCK,
-	 UNDEF_DOMAIN,
 	 SEARCH_ALL);
 }
 
diff --git a/gdb/symtab.c b/gdb/symtab.c
index 6020efe197b..50a0f692521 100644
--- a/gdb/symtab.c
+++ b/gdb/symtab.c
@@ -2863,7 +2863,7 @@ basic_lookup_transparent_type (const char *name)
 bool
 iterate_over_symbols (const struct block *block,
 		      const lookup_name_info &name,
-		      const domain_enum domain,
+		      const domain_search_flags domain,
 		      gdb::function_view<symbol_found_callback_ftype> callback)
 {
   for (struct symbol *sym : block_iterator_range (block, &name))
@@ -2885,7 +2885,7 @@ bool
 iterate_over_symbols_terminated
   (const struct block *block,
    const lookup_name_info &name,
-   const domain_enum domain,
+   const domain_search_flags domain,
    gdb::function_view<symbol_found_callback_ftype> callback)
 {
   if (!iterate_over_symbols (block, name, domain, callback))
@@ -4749,7 +4749,6 @@ global_symbol_searcher::expand_symtabs
      },
      NULL,
      SEARCH_GLOBAL_BLOCK | SEARCH_STATIC_BLOCK,
-     UNDEF_DOMAIN,
      kind);
 
   /* Here, we search through the minimal symbol tables for functions and
@@ -6403,7 +6402,7 @@ find_main_name (void)
      [&symbol_found_p, pspace] (objfile *obj)
        {
 	 language lang
-	   = obj->lookup_global_symbol_language ("main", VAR_DOMAIN,
+	   = obj->lookup_global_symbol_language ("main", SEARCH_VFT,
 						 &symbol_found_p);
 	 if (symbol_found_p)
 	   {
diff --git a/gdb/symtab.h b/gdb/symtab.h
index 5f2b17a3cee..80ee9e02475 100644
--- a/gdb/symtab.h
+++ b/gdb/symtab.h
@@ -2779,7 +2779,7 @@ typedef bool (symbol_found_callback_ftype) (struct block_symbol *bsym);
 
 bool iterate_over_symbols (const struct block *block,
 			   const lookup_name_info &name,
-			   const domain_enum domain,
+			   const domain_search_flags domain,
 			   gdb::function_view<symbol_found_callback_ftype> callback);
 
 /* Like iterate_over_symbols, but if all calls to CALLBACK return
@@ -2789,7 +2789,7 @@ bool iterate_over_symbols (const struct block *block,
 bool iterate_over_symbols_terminated
   (const struct block *block,
    const lookup_name_info &name,
-   const domain_enum domain,
+   const domain_search_flags domain,
    gdb::function_view<symbol_found_callback_ftype> callback);
 
 /* Storage type used by demangle_for_lookup.  demangle_for_lookup
