int flags; /* Lookup flags. */
vec<tree, va_heap, vl_embed> *scopes;
name_lookup *previous; /* Previously active lookup. */
- hash_set<tree> *fn_set;
protected:
/* Marked scope stack for outermost name lookup. */
public:
name_lookup (tree n, int f = 0)
: name (n), value (NULL_TREE), type (NULL_TREE), flags (f),
- scopes (NULL), previous (NULL), fn_set (NULL)
+ scopes (NULL), previous (NULL)
{
preserve_state ();
}
~name_lookup ()
{
- gcc_checking_assert (!fn_set);
restore_state ();
}
previous->scopes->quick_push (decl);
}
}
+
+ /* Unmark the outer partial lookup. */
+ lookup_mark (previous->value, false);
}
else
scopes = shared_scopes;
active = previous;
if (previous)
{
+ free (scopes);
+
unsigned length = vec_safe_length (previous->scopes);
for (unsigned ix = 0; ix != length; ix++)
{
LOOKUP_SEEN_P (decl) = true;
}
- free (scopes);
+ /* Remark the outer partial lookup. */
+ lookup_mark (previous->value, true);
}
else
shared_scopes = scopes;
&& same_type_p (TREE_TYPE (value), TREE_TYPE (new_val))))
;
else if (OVL_P (value) && OVL_P (new_val))
- {
- for (ovl_iterator iter (new_val); iter; ++iter)
- value = lookup_add (*iter, value);
- }
+ value = lookup_add (new_val, value);
else
value = ambiguous (new_val, value);
}
return;
/* Only add those that aren't already there. */
- for (ovl_iterator iter (fns); iter; ++iter)
- if (!fn_set->add (*iter))
- value = lookup_add (*iter, value);
+ value = lookup_maybe_add (fns, value);
}
/* Add functions of a namespace to the lookup structure. */
tree
name_lookup::search_adl (tree fns, vec<tree, va_gc> *args)
{
+ lookup_mark (fns, true);
value = fns;
- /* Add the current overload set into the hash table. */
- fn_set = new hash_set<tree>;
- for (lkp_iterator iter (fns); iter; ++iter)
- fn_set->add (*iter);
-
unsigned ix;
tree arg;
else
adl_expr (arg);
- delete fn_set;
- fn_set = NULL;
-
fns = value;
+ lookup_mark (fns, false);
return fns;
}
inform (DECL_SOURCE_LOCATION (shadowed), "shadowed declaration is here");
}
-
/* DECL is being pushed inside function CTX. Set its context, if
needed. */
}
/* Record a decl-node X as belonging to the current lexical scope.
- It's a friend if IS_FRIEND is true. */
+ It's a friend if IS_FRIEND is true -- which affects exactly where
+ we push it. */
tree
pushdecl (tree x, bool is_friend)
{
- tree ret;
bool subtime = timevar_cond_start (TV_NAME_LOOKUP);
- ret = do_pushdecl (x, is_friend);
+ tree ret = do_pushdecl (x, is_friend);
timevar_cond_stop (TV_NAME_LOOKUP, subtime);
return ret;
}
supplement_binding (binding, val);
}
-/* Set value binding og NAME in the global namespace to VAL. Does not
+/* Set value binding of NAME in the global namespace to VAL. Does not
add it to the list of things in the namespace. */
void