const struct block *block;
const char *name;
const int wild_match_p = should_use_wild_match (name0);
- int cacheIfUnique;
+ int syms_from_global_search = 0;
int ndefns;
obstack_free (&symbol_list_obstack, NULL);
obstack_init (&symbol_list_obstack);
- cacheIfUnique = 0;
-
/* Search specified block and its superiors. */
name = name0;
already performed this search before. If we have, then return
the same result. */
- cacheIfUnique = 1;
if (lookup_cached_symbol (name0, namespace, &sym, &block))
{
if (sym != NULL)
goto done;
}
+ syms_from_global_search = 1;
+
/* Search symbols from all global blocks. */
add_nonlocal_symbols (&symbol_list_obstack, name, namespace, 1,
ndefns = remove_extra_symbols (*results, ndefns);
- if (ndefns == 0 && full_search)
+ if (ndefns == 0 && full_search && syms_from_global_search)
cache_symbol (name0, namespace, NULL, NULL);
- if (ndefns == 1 && full_search && cacheIfUnique)
+ if (ndefns == 1 && full_search && syms_from_global_search)
cache_symbol (name0, namespace, (*results)[0].sym, (*results)[0].block);
ndefns = remove_irrelevant_renamings (*results, ndefns, block0);