}
~name_lookup ()
{
+ gcc_checking_assert (!deduping);
restore_state ();
}
name_lookup (const name_lookup &);
name_lookup &operator= (const name_lookup &);
+ public:
+ /* Turn on or off deduping mode. */
+ void dedup (bool state)
+ {
+ if (deduping != state)
+ {
+ deduping = state;
+ lookup_mark (value, state);
+ }
+ }
+
protected:
static bool seen_p (tree scope)
{
void
name_lookup::restore_state ()
{
- if (deduping)
- lookup_mark (value, false);
+ gcc_checking_assert (!deduping);
/* Unmark and empty this lookup's scope stack. */
for (unsigned ix = vec_safe_length (scopes); ix--;)
probe = ovl_skip_hidden (probe);
if (probe && TREE_CODE (probe) == OVERLOAD
&& OVL_DEDUP_P (probe))
- {
- /* We're about to add something found by multiple paths, so
- need to engage deduping mode. */
- lookup_mark (value, true);
- deduping = true;
- }
+ /* We're about to add something found by multiple paths, so need to
+ engage deduping mode. */
+ dedup (true);
}
value = lookup_maybe_add (fns, value, deduping);
value = ORIGINAL_NAMESPACE (value);
else
{
- if (deduping)
- {
- /* Disengage deduping mode. */
- lookup_mark (value, false);
- deduping = false;
- }
+ /* Disengage deduping mode. */
+ dedup (false);
value = ambiguous (new_val, value);
}
}
if ((hit & 1 && BINDING_VECTOR_GLOBAL_DUPS_P (val))
|| (hit & 2
&& BINDING_VECTOR_PARTITION_DUPS_P (val)))
- {
- lookup_mark (value, true);
- deduping = true;
- }
+ dedup (true);
}
dup_detect |= dup;
}
found = search_usings (scope);
}
+ dedup (false);
+
return found;
}
break;
}
+ dedup (false);
+
/* Restore to incoming length. */
vec_safe_truncate (queue, length);
else if (MODULE_BINDING_PARTITION_P (bind))
dup = 2;
if (unsigned hit = dup_detect & dup)
- {
- if ((hit & 1 && BINDING_VECTOR_GLOBAL_DUPS_P (val))
- || (hit & 2
- && BINDING_VECTOR_PARTITION_DUPS_P (val)))
- {
- lookup_mark (value, true);
- deduping = true;
- }
- }
+ if ((hit & 1 && BINDING_VECTOR_GLOBAL_DUPS_P (val))
+ || (hit & 2
+ && BINDING_VECTOR_PARTITION_DUPS_P (val)))
+ dedup (true);
dup_detect |= dup;
}
if (CP_DECL_CONTEXT (fn) != context)
continue;
- if (!deduping)
- {
- lookup_mark (value, true);
- deduping = true;
- }
+ dedup (true);
/* Template specializations are never found by name lookup.
(Templates themselves can be found, but not template
if (vec_safe_length (scopes))
{
/* Now do the lookups. */
- if (fns)
- {
- deduping = true;
- lookup_mark (fns, true);
- }
value = fns;
+ if (fns)
+ dedup (true);
/* INST_PATH will be NULL, if this is /not/ 2nd-phase ADL. */
bitmap inst_path = NULL;
if (tree bind = *mslot)
{
- if (!deduping)
- {
- /* We must turn on deduping, because some
- other class from this module might also
- be in this namespace. */
- deduping = true;
- lookup_mark (value, true);
- }
+ /* We must turn on deduping, because some other class
+ from this module might also be in this namespace. */
+ dedup (true);
/* Add the exported fns */
if (STAT_HACK_P (bind))
}
fns = value;
+ dedup (false);
}
return fns;