Commit 147135cc by Gabriel Dos Reis Committed by Gabriel Dos Reis

cp-tree.h, [...]: Remove reference to macros BINDING_SCOPE, BINDING_VALUE and BINDING_TYPE.

	* cp-tree.h, name-lookup.h, decl.c, decl2.c: Remove reference to
	macros 	BINDING_SCOPE, BINDING_VALUE and BINDING_TYPE.

From-SVN: r71848
parent 07a6b250
2003-09-27 Gabriel Dos Reis <gdr@integrable-solutions.net>
* cp-tree.h, name-lookup.h, decl.c, decl2.c: Remove reference to
macros BINDING_SCOPE, BINDING_VALUE and BINDING_TYPE.
2003-09-26 Gabriel Dos Reis <gdr@integrable-solutions.net>
* decl.c (pop_binding_level, suspend_binding_level,
......@@ -14,7 +19,7 @@
(cp_parser_member_declaration): Use it.
(cp_parser_template_declaration_after_export): Likewise.
2003-09-22 Gabriel Dos Reis <gcc@integrable-solutions.net>
2003-09-22 Gabriel Dos Reis <gdr@integrable-solutions.net>
* cp-tree.h (scope_kind): Add new enumerator.
(keep_next_level): Change parameter type to bool.
......
......@@ -379,10 +379,10 @@ typedef enum cp_id_kind
/* The IDENTIFIER_BINDING is the innermost cxx_binding for the
identifier. It's PREVIOUS is the next outermost binding. Each
BINDING_VALUE is a DECL for the associated declaration. Thus,
VALUE field is a DECL for the associated declaration. Thus,
name lookup consists simply of pulling off the node at the front
of the list (modulo oddities for looking up the names of types,
and such.) You can use BINDING_SCOPE to determine the scope
and such.) You can use SCOPE field to determine the scope
that bound the name. */
#define IDENTIFIER_BINDING(NODE) \
(LANG_IDENTIFIER_CAST (NODE)->bindings)
......@@ -394,7 +394,7 @@ typedef enum cp_id_kind
/* If IDENTIFIER_CLASS_VALUE is set, then NODE is bound in the current
class, and IDENTIFIER_CLASS_VALUE is the value binding. This is
just a pointer to the BINDING_VALUE of one of the bindings in the
just a pointer to the VALUE field of one of the bindings in the
IDENTIFIER_BINDINGs list, so any time that this is non-NULL so is
IDENTIFIER_BINDING. */
#define IDENTIFIER_CLASS_VALUE(NODE) \
......
......@@ -3159,7 +3159,7 @@ ambiguous_decl (tree name, cxx_binding *old, cxx_binding *new, int flags)
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))
{
......@@ -3188,43 +3188,43 @@ ambiguous_decl (tree name, cxx_binding *old, cxx_binding *new, int flags)
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));
}
}
......@@ -3258,8 +3258,7 @@ lookup_using_namespace (tree name, cxx_binding *val, tree usings, tree scope,
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]
......@@ -3286,7 +3285,7 @@ qualified_lookup_using_namespace (tree name, tree scope, cxx_binding *result,
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))
......@@ -3993,16 +3992,16 @@ do_toplevel_using_decl (tree decl)
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;
}
......
......@@ -336,7 +336,7 @@ supplement_binding (cxx_binding *binding, tree decl)
else if (TREE_CODE (bval) == TYPE_DECL && DECL_ARTIFICIAL (bval))
{
/* The old binding was a type name. It was placed in
BINDING_VALUE because it was thought, at the point it was
VALUE field because it was thought, at the point it was
declared, to be the only entity with such a name. Move the
type name into the type slot; it is now hidden by the new
binding. */
......@@ -395,7 +395,7 @@ find_binding (cxx_scope *scope, cxx_binding *binding)
timevar_push (TV_NAME_LOOKUP);
for (; binding != NULL; binding = binding->previous)
if (BINDING_SCOPE (binding) == scope)
if (binding->scope == scope)
POP_TIMEVAR_AND_RETURN (TV_NAME_LOOKUP, binding);
POP_TIMEVAR_AND_RETURN (TV_NAME_LOOKUP, (cxx_binding *)0);
......@@ -409,7 +409,7 @@ cxx_scope_find_binding_for_name (cxx_scope *scope, tree name)
if (b)
{
/* Fold-in case where NAME is used only once. */
if (scope == BINDING_SCOPE (b) && b->previous == NULL)
if (scope == b->scope && b->previous == NULL)
return b;
return find_binding (scope, b);
}
......@@ -430,7 +430,7 @@ binding_for_name (cxx_scope *scope, tree name)
/* Not found, make a new one. */
result = cxx_binding_make (NULL, NULL);
result->previous = IDENTIFIER_NAMESPACE_BINDINGS (name);
BINDING_SCOPE (result) = scope;
result->scope = scope;
result->is_local = false;
result->value_is_inherited = false;
IDENTIFIER_NAMESPACE_BINDINGS (name) = result;
......@@ -465,10 +465,8 @@ set_namespace_binding (tree name, tree scope, tree val)
if (scope == NULL_TREE)
scope = global_namespace;
b = binding_for_name (NAMESPACE_LEVEL (scope), name);
if (!BINDING_VALUE (b)
|| TREE_CODE (val) == OVERLOAD
|| val == error_mark_node)
BINDING_VALUE (b) = val;
if (!b->value || TREE_CODE (val) == OVERLOAD || val == error_mark_node)
b->value = val;
else
supplement_binding (b, val);
timevar_pop (TV_NAME_LOOKUP);
......
......@@ -72,22 +72,10 @@ typedef struct cp_binding_level cxx_scope;
or namespace scope. */
#define LOCAL_BINDING_P(NODE) ((NODE)->is_local)
/* Nonzero if BINDING_VALUE is from a base class of the class which is
/* True if NODE->value is from a base class of the class which is
currently being defined. */
#define INHERITED_VALUE_BINDING_P(NODE) ((NODE)->value_is_inherited)
/* For a binding between a name and an entity at a non-local scope,
defines the scope where the binding is declared. (Either a class
_TYPE node, or a NAMESPACE_DECL.). */
#define BINDING_SCOPE(NODE) ((NODE)->scope)
/* This is the declaration bound to the name. Possible values:
variable, overloaded function, namespace, template, enumerator. */
#define BINDING_VALUE(NODE) ((NODE)->value)
/* If name is bound to a type, this is the type (struct, union, enum). */
#define BINDING_TYPE(NODE) ((NODE)->type)
/* Zero out a cxx_binding pointed to by B. */
#define cxx_binding_clear(B) memset ((B), 0, sizeof (cxx_binding))
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment