/* Now, fill in the binding information. */
binding->previous = IDENTIFIER_BINDING (id);
- BINDING_SCOPE (binding) = level;
+ binding->scope = level;
INHERITED_VALUE_BINDING_P (binding) = 0;
LOCAL_BINDING_P (binding) = (level != class_binding_level);
other purpose. */
note_name_declared_in_class (id, decl);
- if (binding && BINDING_SCOPE (binding) == class_binding_level)
+ if (binding && binding->scope == class_binding_level)
/* Supplement the existing binding. */
result = supplement_binding (IDENTIFIER_BINDING (id), decl);
else
because of the possibility of the `struct stat' hack; if DECL is
a class-name or enum-name we might prefer a field-name, or some
such. */
- IDENTIFIER_CLASS_VALUE (id) = BINDING_VALUE (IDENTIFIER_BINDING (id));
+ IDENTIFIER_CLASS_VALUE (id) = IDENTIFIER_BINDING (id)->value;
/* If this is a binding from a base class, mark it as such. */
binding = IDENTIFIER_BINDING (id);
- if (BINDING_VALUE (binding) == decl && TREE_CODE (decl) != TREE_LIST)
+ if (binding->value == decl && TREE_CODE (decl) != TREE_LIST)
{
if (TREE_CODE (decl) == OVERLOAD)
context = CP_DECL_CONTEXT (OVL_CURRENT (decl));
else
INHERITED_VALUE_BINDING_P (binding) = 0;
}
- else if (BINDING_VALUE (binding) == decl)
+ else if (binding->value == decl)
/* We only encounter a TREE_LIST when push_class_decls detects an
ambiguity. Such an ambiguity can be overridden by a definition
in this class. */
/* The DECL will be either the ordinary binding or the type
binding for this identifier. Remove that binding. */
- if (BINDING_VALUE (binding) == decl)
- BINDING_VALUE (binding) = NULL_TREE;
- else if (BINDING_TYPE (binding) == decl)
- BINDING_TYPE (binding) = NULL_TREE;
+ if (binding->value == decl)
+ binding->value = NULL_TREE;
+ else if (binding->type == decl)
+ binding->type = NULL_TREE;
else
abort ();
- if (!BINDING_VALUE (binding) && !BINDING_TYPE (binding))
+ if (!binding->value && !binding->type)
{
/* We're completely done with the innermost binding for this
identifier. Unhook it from the list of bindings. */
/* Add it to the free list. */
cxx_binding_free (binding);
- /* Clear the BINDING_SCOPE so the garbage collector doesn't walk
- it. */
- BINDING_SCOPE (binding) = NULL;
+ /* Clear the SCOPE so the garbage collector doesn't walk it. */
+ binding->scope = NULL;
}
}
ns_binding = NULL_TREE;
if (outer_binding
- && (BINDING_SCOPE (outer_binding)
- == current_binding_level->level_chain))
+ && outer_binding->scope == current_binding_level->level_chain)
/* We have something like:
int i;
keep the binding of the inner `i' in this case. */
pop_binding (DECL_NAME (link), link);
else if ((outer_binding
- && (TREE_CODE (BINDING_VALUE (outer_binding))
- == TYPE_DECL))
- || (ns_binding
- && TREE_CODE (ns_binding) == TYPE_DECL))
+ && (TREE_CODE (outer_binding->value) == TYPE_DECL))
+ || (ns_binding && TREE_CODE (ns_binding) == TYPE_DECL))
/* Here, we have something like:
typedef int I;
/* Keep track of what should have happened when we
popped the binding. */
- if (outer_binding && BINDING_VALUE (outer_binding))
- DECL_SHADOWED_FOR_VAR (link)
- = BINDING_VALUE (outer_binding);
+ if (outer_binding && outer_binding->value)
+ DECL_SHADOWED_FOR_VAR (link) = outer_binding->value;
/* Add it to the list of dead variables in the next
outermost binding to that we can remove these when we
dead_vars_from_for);
/* Although we don't pop the cxx_binding, we do clear
- its BINDING_SCOPE since the level is going away now. */
- BINDING_SCOPE (IDENTIFIER_BINDING (DECL_NAME (link))) = 0;
+ its SCOPE since the scope is going away now. */
+ IDENTIFIER_BINDING (DECL_NAME (link))->scope = NULL;
}
}
else
cxx_binding *binding;
binding = IDENTIFIER_BINDING (TREE_PURPOSE (shadowed));
- while (binding && BINDING_SCOPE (binding) != b)
+ while (binding && binding->scope != b)
binding = binding->previous;
if (binding)
IDENTIFIER_CLASS_VALUE (TREE_PURPOSE (shadowed))
- = BINDING_VALUE (binding);
+ = binding->value;
}
}
else
binding_for_name (NAMESPACE_LEVEL (current_namespace), id);
if (decl)
{
- if (BINDING_VALUE (binding))
+ if (binding->value)
supplement_binding (binding, decl);
else
- BINDING_VALUE (binding) = decl;
+ binding->value = decl;
}
else
abort ();
class, then we will need to restore IDENTIFIER_CLASS_VALUE when
we leave this class. Record the shadowed declaration here. */
binding = IDENTIFIER_BINDING (name);
- if (binding && BINDING_VALUE (binding))
+ if (binding && binding->value)
{
- tree bval = BINDING_VALUE (binding);
+ tree bval = binding->value;
tree old_decl = NULL_TREE;
if (INHERITED_VALUE_BINDING_P (binding))
if (TREE_CODE (bval) == TYPE_DECL && DECL_ARTIFICIAL (bval)
&& !(TREE_CODE (x) == TYPE_DECL && DECL_ARTIFICIAL (x)))
{
- old_decl = BINDING_TYPE (binding);
- BINDING_TYPE (binding) = bval;
- BINDING_VALUE (binding) = NULL_TREE;
+ old_decl = binding->type;
+ binding->type = bval;
+ binding->value = NULL_TREE;
INHERITED_VALUE_BINDING_P (binding) = 0;
}
else
if (TREE_PURPOSE (shadow) == name
&& TREE_TYPE (shadow) == old_decl)
{
- BINDING_VALUE (binding) = x;
+ binding->value = x;
INHERITED_VALUE_BINDING_P (binding) = 0;
TREE_TYPE (shadow) = x;
IDENTIFIER_CLASS_VALUE (name) = x;
{
tree *d;
- for (d = &BINDING_SCOPE (IDENTIFIER_BINDING (name))->names;
+ for (d = &IDENTIFIER_BINDING (name)->scope->names;
*d;
d = &TREE_CHAIN (*d))
if (*d == old
TREE_CHAIN (*d));
/* And update the cxx_binding node. */
- BINDING_VALUE (IDENTIFIER_BINDING (name))
- = new_binding;
+ IDENTIFIER_BINDING (name)->value = new_binding;
POP_TIMEVAR_AND_RETURN (TV_NAME_LOOKUP, decl);
}
/* Given NAME, an IDENTIFIER_NODE,
return the structure (or union or enum) definition for that name.
- Searches binding levels from BINDING_SCOPE up to the global level.
+ Searches binding levels from its SCOPE up to the global level.
If THISLEVEL_ONLY is nonzero, searches only the specified context
(but skips any sk_cleanup contexts to find one that is
meaningful for tags).
class declaration, then we use the _TYPE node for the
template. See the example below. */
if (thislevel_only && !allow_template_parms_p
- && binding && BINDING_VALUE (binding)
- && DECL_CLASS_TEMPLATE_P (BINDING_VALUE (binding)))
- old = BINDING_VALUE (binding);
+ && binding && binding->value
+ && DECL_CLASS_TEMPLATE_P (binding->value))
+ old = binding->value;
else if (binding)
old = select_decl (binding, LOOKUP_PREFER_TYPES);
else
select_decl (cxx_binding *binding, int flags)
{
tree val;
- val = BINDING_VALUE (binding);
+ val = binding->value;
timevar_push (TV_NAME_LOOKUP);
if (LOOKUP_NAMESPACES_ONLY (flags))
/* If looking for a type, or if there is no non-type binding, select
the value binding. */
- if (BINDING_TYPE (binding)
- && (!val || (flags & LOOKUP_PREFER_TYPES)))
- val = BINDING_TYPE (binding);
+ if (binding->type && (!val || (flags & LOOKUP_PREFER_TYPES)))
+ val = binding->type;
/* Don't return non-types if we really prefer types. */
else if (val && LOOKUP_TYPES_ONLY (flags) && TREE_CODE (val) != TYPE_DECL
&& (TREE_CODE (val) != TEMPLATE_DECL
*spacesp = tree_cons (scope, NULL_TREE, *spacesp);
/* Ignore anticipated built-in functions. */
- if (b && BINDING_VALUE (b)
- && DECL_P (BINDING_VALUE (b))
- && DECL_LANG_SPECIFIC (BINDING_VALUE (b))
- && DECL_ANTICIPATED (BINDING_VALUE (b)))
+ if (b && b->value && DECL_P (b->value)
+ && DECL_LANG_SPECIFIC (b->value) && DECL_ANTICIPATED (b->value))
/* Keep binding cleared. */;
else if (b)
{
/* Initialize binding for this context. */
- binding.value = BINDING_VALUE (b);
- binding.type = BINDING_TYPE (b);
+ binding.value = b->value;
+ binding.type = b->type;
}
/* Add all _DECLs seen through local using-directives. */
continue;
/* If this is the kind of thing we're looking for, we're done. */
- if (qualify_lookup (BINDING_VALUE (iter), flags))
- binding = BINDING_VALUE (iter);
+ if (qualify_lookup (iter->value, flags))
+ binding = iter->value;
else if ((flags & LOOKUP_PREFER_TYPES)
- && qualify_lookup (BINDING_TYPE (iter), flags))
- binding = BINDING_TYPE (iter);
+ && qualify_lookup (iter->type, flags))
+ binding = iter->type;
else
binding = NULL_TREE;
{
while (1)
{
- if (BINDING_SCOPE (IDENTIFIER_BINDING (name)) == b)
+ if (IDENTIFIER_BINDING (name)->scope == b)
POP_TIMEVAR_AND_RETURN (TV_NAME_LOOKUP, IDENTIFIER_VALUE (name));
if (b->kind == sk_cleanup)
cxx_binding *outer_binding
= IDENTIFIER_BINDING (DECL_NAME (decl))->previous;
- if (outer_binding && BINDING_SCOPE (outer_binding) == outer
- && (TREE_CODE (BINDING_VALUE (outer_binding)) == VAR_DECL)
- && DECL_DEAD_FOR_LOCAL (BINDING_VALUE (outer_binding)))
+ if (outer_binding && outer_binding->scope == outer
+ && (TREE_CODE (outer_binding->value) == VAR_DECL)
+ && DECL_DEAD_FOR_LOCAL (outer_binding->value))
{
- BINDING_VALUE (outer_binding)
- = DECL_SHADOWED_FOR_VAR (BINDING_VALUE (outer_binding));
+ outer_binding->value = DECL_SHADOWED_FOR_VAR (outer_binding->value);
current_binding_level->kind = sk_block;
}
}
tree val, type;
my_friendly_assert (old != NULL, 393);
/* Copy the value. */
- val = BINDING_VALUE (new);
+ val = new->value;
if (val)
switch (TREE_CODE (val))
{
val = NULL_TREE;
}
- if (!BINDING_VALUE (old))
- BINDING_VALUE (old) = val;
- else if (val && val != BINDING_VALUE (old))
+ if (!old->value)
+ old->value = val;
+ else if (val && val != old->value)
{
- if (is_overloaded_fn (BINDING_VALUE (old)) && is_overloaded_fn (val))
- BINDING_VALUE (old) = merge_functions (BINDING_VALUE (old), val);
+ if (is_overloaded_fn (old->value) && is_overloaded_fn (val))
+ old->value = merge_functions (old->value, val);
else
{
/* Some declarations are functions, some are not. */
if (flags & LOOKUP_COMPLAIN)
{
/* If we've already given this error for this lookup,
- BINDING_VALUE (old) is error_mark_node, so let's not
+ old->value is error_mark_node, so let's not
repeat ourselves. */
- if (BINDING_VALUE (old) != error_mark_node)
+ if (old->value != error_mark_node)
{
error ("use of `%D' is ambiguous", name);
cp_error_at (" first declared as `%#D' here",
- BINDING_VALUE (old));
+ old->value);
}
cp_error_at (" also declared as `%#D' here", val);
}
- BINDING_VALUE (old) = error_mark_node;
+ old->value = error_mark_node;
}
}
/* ... and copy the type. */
- type = BINDING_TYPE (new);
+ type = new->type;
if (LOOKUP_NAMESPACES_ONLY (flags))
type = NULL_TREE;
- if (!BINDING_TYPE (old))
- BINDING_TYPE (old) = type;
- else if (type && BINDING_TYPE (old) != type)
+ if (!old->type)
+ old->type = type;
+ else if (type && old->type != type)
{
if (flags & LOOKUP_COMPLAIN)
{
error ("`%D' denotes an ambiguous type",name);
- error ("%J first type here", TYPE_MAIN_DECL (BINDING_TYPE (old)));
+ error ("%J first type here", TYPE_MAIN_DECL (old->type));
error ("%J other type here", TYPE_MAIN_DECL (type));
}
}
if (val1)
val = ambiguous_decl (name, val, val1, flags);
}
- POP_TIMEVAR_AND_RETURN (TV_NAME_LOOKUP,
- BINDING_VALUE (val) != error_mark_node);
+ POP_TIMEVAR_AND_RETURN (TV_NAME_LOOKUP, val->value != error_mark_node);
}
/* [namespace.qual]
seen = tree_cons (scope, NULL_TREE, seen);
if (binding)
result = ambiguous_decl (name, result, binding, flags);
- if (!BINDING_VALUE (result) && !BINDING_TYPE (result))
+ if (!result->value && !result->type)
/* Consider using directives. */
for (usings = DECL_NAMESPACE_USING (scope); usings;
usings = TREE_CHAIN (usings))
binding = binding_for_name (NAMESPACE_LEVEL (current_namespace), name);
- oldval = BINDING_VALUE (binding);
- oldtype = BINDING_TYPE (binding);
+ oldval = binding->value;
+ oldtype = binding->type;
do_nonmember_using_decl (scope, name, oldval, oldtype, &newval, &newtype);
/* Copy declarations found. */
if (newval)
- BINDING_VALUE (binding) = newval;
+ binding->value = newval;
if (newtype)
- BINDING_TYPE (binding) = newtype;
+ binding->type = newtype;
return;
}