return {};
}
-/* Search for symbols whose name match NAME in the given SCOPE.
- if BLOCK is a function, we'll search first through the template
- parameters and function type. Afterwards (or if BLOCK is not a function)
- search through imported directives using cp_lookup_symbol_via_imports. */
+/* Search for symbols whose name match NAME in the given SCOPE. */
struct block_symbol
-cp_lookup_symbol_imports_or_template (const char *scope,
- const char *name,
- const struct block *block,
- const domain_search_flags domain)
+cp_lookup_symbol_imports (const char *scope,
+ const char *name,
+ const struct block *block,
+ const domain_search_flags domain)
{
struct symbol *function = block->function ();
symbol_lookup_debug_printf
- ("cp_lookup_symbol_imports_or_template (%s, %s, %s, %s)",
+ ("cp_lookup_symbol_imports (%s, %s, %s, %s)",
scope, name, host_address_to_string (block),
domain_name (domain).c_str ());
if (function != NULL && function->language () == language_cplus)
{
- /* Search the function's template parameters. */
- if (function->is_template_function ())
- {
- struct template_symbol *templ
- = (struct template_symbol *) function;
- struct symbol *sym = search_symbol_list (name,
- templ->n_template_arguments,
- templ->template_arguments);
-
- if (sym != NULL)
- {
- symbol_lookup_debug_printf
- ("cp_lookup_symbol_imports_or_template (...) = %s",
- host_address_to_string (sym));
- return (struct block_symbol) {sym, block};
- }
- }
-
/* Search the template parameters of the function's defining
context. */
if (function->natural_name ())
if (sym != NULL)
{
symbol_lookup_debug_printf
- ("cp_lookup_symbol_imports_or_template (...) = %s",
+ ("cp_lookup_symbol_imports (...) = %s",
host_address_to_string (sym));
return (struct block_symbol) {sym, parent};
}
struct block_symbol result
= cp_lookup_symbol_via_imports (scope, name, block, domain, 1, 1);
- symbol_lookup_debug_printf ("cp_lookup_symbol_imports_or_template (...) = %s\n",
+ symbol_lookup_debug_printf ("cp_lookup_symbol_imports (...) = %s\n",
result.symbol != nullptr
? host_address_to_string (result.symbol) : "NULL");
return result;
if (sym != NULL)
return (struct block_symbol) {sym, block};
+ struct symbol *function = block->function ();
+ if (function != nullptr && function->is_template_function ())
+ {
+ struct template_symbol *templ = (struct template_symbol *) function;
+ sym = search_symbol_list (name,
+ templ->n_template_arguments,
+ templ->template_arguments);
+ if (sym != nullptr)
+ return (struct block_symbol) {sym, block};
+ }
+
if (language == language_cplus || language == language_fortran)
{
struct block_symbol blocksym
- = cp_lookup_symbol_imports_or_template (scope, name, block,
- domain);
+ = cp_lookup_symbol_imports (scope, name, block, domain);
if (blocksym.symbol != NULL)
return blocksym;
}
- if (block->function () != NULL && block->inlined_p ())
+ if (function != nullptr && block->inlined_p ())
break;
block = block->superblock ();
}