This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[stree] Committed: eliminate a wasted word in cxx_binding


Previously we always allocated two fields, one for the stree index and one for the tree value. We never need both at once. We can have a union instead, and use a bit in cxx_binding itself to say which field is active.

--Matt


Index: gcc/ChangeLog.stree =================================================================== RCS file: /cvs/gcc/gcc/gcc/Attic/ChangeLog.stree,v retrieving revision 1.1.2.1 diff -p -r1.1.2.1 ChangeLog.stree *** gcc/ChangeLog.stree 9 Mar 2004 00:41:53 -0000 1.1.2.1 --- gcc/ChangeLog.stree 14 Apr 2004 01:22:56 -0000 *************** *** 1,3 **** --- 1,6 ---- + 2004-04-13 Matt Austern <austern@apple.com + * stree.h (struct s_tree_i_or_tree): Remove. + 2004-03-08 Matt Austern <austern@apple.com> * ChangeLog.stree: New. * Makefile.in: Add stree.[ch] to the build. Index: gcc/stree.h =================================================================== RCS file: /cvs/gcc/gcc/gcc/Attic/stree.h,v retrieving revision 1.1.2.1 diff -p -r1.1.2.1 stree.h *** gcc/stree.h 9 Mar 2004 00:41:53 -0000 1.1.2.1 --- gcc/stree.h 14 Apr 2004 01:22:57 -0000 *************** Software Foundation, 59 Temple Place - S *** 29,39 **** /* An index of a s_tree. */ typedef unsigned long s_tree_i;

- struct s_tree_i_or_tree GTY (()) {
-   tree t;
-   s_tree_i st;
- };
-
  #define NULL_S_TREE_I 0

  /* Given an s_tree_i, return the corresponding tree.  */
--- 29,34 ----
Index: gcc/cp/decl.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/cp/decl.c,v
retrieving revision 1.1191.2.1
diff -p -r1.1191.2.1 decl.c
*** gcc/cp/decl.c	9 Mar 2004 00:41:54 -0000	1.1191.2.1
--- gcc/cp/decl.c	14 Apr 2004 01:22:57 -0000
*************** poplevel (int keep, int reverse, int fun
*** 607,613 ****
  		 popped the binding.  */
  	      if (outer_binding && binding_value_tree (DECL_NAME (link),
  						       outer_binding))
! 		DECL_SHADOWED_FOR_VAR (link) = outer_binding->value.t;

  	      /* Add it to the list of dead variables in the next
  		 outermost binding to that we can remove these when we
--- 607,613 ----
  		 popped the binding.  */
  	      if (outer_binding && binding_value_tree (DECL_NAME (link),
  						       outer_binding))
! 		DECL_SHADOWED_FOR_VAR (link) = CXX_BINDING_VALUE (outer_binding);

  	      /* Add it to the list of dead variables in the next
  		 outermost binding to that we can remove these when we
Index: gcc/cp/name-lookup.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/cp/name-lookup.c,v
retrieving revision 1.42.2.1
diff -p -r1.42.2.1 name-lookup.c
*** gcc/cp/name-lookup.c	9 Mar 2004 00:41:54 -0000	1.42.2.1
--- gcc/cp/name-lookup.c	14 Apr 2004 01:22:57 -0000
*************** cxx_binding_make (tree value, tree type)
*** 338,345 ****
    else
      binding = ggc_alloc (sizeof (cxx_binding));

!   binding->value.t = value;
!   binding->value.st = NULL_S_TREE_I;
    binding->type = type;
    binding->previous = NULL;

--- 338,344 ----
    else
      binding = ggc_alloc (sizeof (cxx_binding));

!   CXX_BINDING_SET_VALUE (binding, value);
    binding->type = type;
    binding->previous = NULL;

*************** pop_binding (tree id, tree decl)
*** 396,412 ****

    /* The DECL will be either the ordinary binding or the type
       binding for this identifier.  Remove that binding.  */
!   if (binding->value.t == decl)
      {
!       binding->value.t = NULL_TREE;
!       binding->value.st = NULL_S_TREE_I;
      }
    else if (binding->type == decl)
      binding->type = NULL_TREE;
    else
      abort ();

!   if (!binding->value.t && !binding->value.st && !binding->type)
      {
        /* We're completely done with the innermost binding for this
  	 identifier.  Unhook it from the list of bindings.  */
--- 395,412 ----

    /* The DECL will be either the ordinary binding or the type
       binding for this identifier.  Remove that binding.  */
!   if (CXX_BINDING_VALUE (binding) == decl)
      {
!       CXX_BINDING_SET_VALUE (binding, NULL_TREE);
      }
    else if (binding->type == decl)
      binding->type = NULL_TREE;
    else
      abort ();

! if (!CXX_BINDING_VALUE (binding)
! && !CXX_BINDING_VALUE_S (binding)
! && !binding->type)
{
/* We're completely done with the innermost binding for this
identifier. Unhook it from the list of bindings. */
*************** supplement_binding (tree name, cxx_bindi
*** 456,462 ****
non-class scope prior declaration. In that case, we should have
already issued a diagnostic; for graceful error recovery purpose,
pretend this was the intended declaration for that name. */
! binding->value.t = decl;
else if (TREE_CODE (bval) == TYPE_DECL && DECL_ARTIFICIAL (bval))
{
/* The old binding was a type name. It was placed in
--- 456,462 ----
non-class scope prior declaration. In that case, we should have
already issued a diagnostic; for graceful error recovery purpose,
pretend this was the intended declaration for that name. */
! CXX_BINDING_SET_VALUE (binding, decl);
else if (TREE_CODE (bval) == TYPE_DECL && DECL_ARTIFICIAL (bval))
{
/* The old binding was a type name. It was placed in
*************** supplement_binding (tree name, cxx_bindi
*** 465,471 ****
type name into the type slot; it is now hidden by the new
binding. */
binding->type = bval;
! binding->value.t = decl;
binding->value_is_inherited = false;
}
else if (TREE_CODE (bval) == TYPE_DECL
--- 465,471 ----
type name into the type slot; it is now hidden by the new
binding. */
binding->type = bval;
! CXX_BINDING_SET_VALUE (binding, decl);
binding->value_is_inherited = false;
}
else if (TREE_CODE (bval) == TYPE_DECL
*************** push_s_decl (tree name, s_tree_i s)
*** 563,572 ****
if (current_function_decl || !namespace_bindings_p ())
goto too_hard;
b = binding_for_name (NAMESPACE_LEVEL (current_namespace), name);
! if (b->value.t || b->value.st)
goto too_hard;


! b->value.st = s;

    timevar_pop (TV_NAME_LOOKUP);
    return;
--- 563,572 ----
    if (current_function_decl || !namespace_bindings_p ())
      goto too_hard;
    b = binding_for_name (NAMESPACE_LEVEL (current_namespace), name);
!   if (CXX_BINDING_VALUE (b) || CXX_BINDING_VALUE_S (b))
      goto too_hard;

! CXX_BINDING_SET_VALUE_S (b, s);

    timevar_pop (TV_NAME_LOOKUP);
    return;
*************** maybe_inject_for_scope_var (tree decl)
*** 1151,1160 ****
        if (outer_binding && outer_binding->scope == outer
  	  && (TREE_CODE (binding_value_tree (DECL_NAME (decl),
  					     outer_binding)) == VAR_DECL)
! 	  && DECL_DEAD_FOR_LOCAL (outer_binding->value.t))
  	{
! 	  outer_binding->value.t
! 	    = DECL_SHADOWED_FOR_VAR (outer_binding->value.t);
  	  current_binding_level->kind = sk_block;
  	}
      }
--- 1151,1160 ----
        if (outer_binding && outer_binding->scope == outer
  	  && (TREE_CODE (binding_value_tree (DECL_NAME (decl),
  					     outer_binding)) == VAR_DECL)
! 	  && DECL_DEAD_FOR_LOCAL (CXX_BINDING_VALUE (outer_binding)))
  	{
! 	  CXX_BINDING_SET_VALUE (outer_binding,
! 				 DECL_SHADOWED_FOR_VAR (CXX_BINDING_VALUE (outer_binding)));
  	  current_binding_level->kind = sk_block;
  	}
      }
*************** set_identifier_type_value_with_scope (tr
*** 1769,1778 ****
  	binding_for_name (NAMESPACE_LEVEL (current_namespace), id);
        if (decl)
  	{
! 	  if (binding->value.t || binding->value.st)
  	    supplement_binding (id, binding, decl);
  	  else
! 	    binding->value.t = decl;
  	}
        else
  	abort ();
--- 1769,1778 ----
  	binding_for_name (NAMESPACE_LEVEL (current_namespace), id);
        if (decl)
  	{
! 	  if (CXX_BINDING_VALUE (binding) || CXX_BINDING_VALUE_S (binding))
  	    supplement_binding (id, binding, decl);
  	  else
! 	    CXX_BINDING_SET_VALUE (binding, decl);
  	}
        else
  	abort ();
*************** push_overloaded_decl (tree decl, int fla
*** 2106,2112 ****
  				  TREE_CHAIN (*d));

  		/* And update the cxx_binding node.  */
! 		IDENTIFIER_BINDING (name)->value.t = new_binding;
  		POP_TIMEVAR_AND_RETURN (TV_NAME_LOOKUP, decl);
  	      }

--- 2106,2112 ----
  				  TREE_CHAIN (*d));

  		/* And update the cxx_binding node.  */
! 		CXX_BINDING_SET_VALUE (IDENTIFIER_BINDING (name), new_binding);
  		POP_TIMEVAR_AND_RETURN (TV_NAME_LOOKUP, decl);
  	      }

*************** do_nonmember_using_decl (tree scope, tre
*** 2188,2194 ****
      }

    /* Check for using functions.  */
!   if (decls.value.t && is_overloaded_fn (decls.value.t))
      {
        tree tmp, tmp1;

--- 2188,2195 ----
      }

    /* Check for using functions.  */
!   if (CXX_BINDING_VALUE (&decls)
!       && is_overloaded_fn (CXX_BINDING_VALUE (&decls)))
      {
        tree tmp, tmp1;

*************** do_nonmember_using_decl (tree scope, tre
*** 2200,2206 ****
  	}

        *newval = oldval;
!       for (tmp = decls.value.t; tmp; tmp = OVL_NEXT (tmp))
  	{
  	  tree new_fn = OVL_CURRENT (tmp);

--- 2201,2207 ----
  	}

*newval = oldval;
! for (tmp = CXX_BINDING_VALUE (&decls); tmp; tmp = OVL_NEXT (tmp))
{
tree new_fn = OVL_CURRENT (tmp);


*************** do_nonmember_using_decl (tree scope, tre
*** 2260,2266 ****
      }
    else
      {
!       *newval = decls.value.t;
        if (oldval && !decls_match (*newval, oldval))
  	error ("`%D' is already declared in this scope", name);
      }
--- 2261,2267 ----
      }
    else
      {
!       *newval = CXX_BINDING_VALUE (&decls);
        if (oldval && !decls_match (*newval, oldval))
  	error ("`%D' is already declared in this scope", name);
      }
*************** lookup_tag (enum tree_code form, tree na
*** 2412,2419 ****
  	       template.  See the example below.  */
  	    if (thislevel_only && !allow_template_parms_p
  		&& binding && binding_value_tree (name, binding)
! 		&& DECL_CLASS_TEMPLATE_P (binding->value.t))
! 	      old = binding->value.t;
  	    else if (binding)
  	      old = select_decl (name, binding, LOOKUP_PREFER_TYPES);
              else
--- 2413,2420 ----
  	       template.  See the example below.  */
  	    if (thislevel_only && !allow_template_parms_p
  		&& binding && binding_value_tree (name, binding)
! 		&& DECL_CLASS_TEMPLATE_P (CXX_BINDING_VALUE (binding)))
! 	      old = CXX_BINDING_VALUE (binding);
  	    else if (binding)
  	      old = select_decl (name, binding, LOOKUP_PREFER_TYPES);
              else
*************** push_class_binding (tree id, tree decl)
*** 2689,2699 ****
       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) = IDENTIFIER_BINDING (id)->value.t;

/* If this is a binding from a base class, mark it as such. */
binding = IDENTIFIER_BINDING (id);
! if (binding->value.t == decl && TREE_CODE (decl) != TREE_LIST)
{
if (TREE_CODE (decl) == OVERLOAD)
context = CP_DECL_CONTEXT (OVL_CURRENT (decl));
--- 2690,2700 ----
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) = CXX_BINDING_VALUE (IDENTIFIER_BINDING (id));


/* If this is a binding from a base class, mark it as such. */
binding = IDENTIFIER_BINDING (id);
! if (CXX_BINDING_VALUE (binding) == decl && TREE_CODE (decl) != TREE_LIST)
{
if (TREE_CODE (decl) == OVERLOAD)
context = CP_DECL_CONTEXT (OVL_CURRENT (decl));
*************** push_class_binding (tree id, tree decl)
*** 2708,2714 ****
else
INHERITED_VALUE_BINDING_P (binding) = 0;
}
! else if (binding->value.t == 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. */
--- 2709,2715 ----
else
INHERITED_VALUE_BINDING_P (binding) = 0;
}
! else if (CXX_BINDING_VALUE (binding) == 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. */
*************** push_class_level_binding (tree name, tre
*** 2836,2842 ****
binding = IDENTIFIER_BINDING (name);
if (binding && binding_value_tree (name, binding))
{
! tree bval = binding->value.t;
tree old_decl = NULL_TREE;


        if (INHERITED_VALUE_BINDING_P (binding))
--- 2837,2843 ----
    binding = IDENTIFIER_BINDING (name);
    if (binding && binding_value_tree (name, binding))
      {
!       tree bval = CXX_BINDING_VALUE (binding);
        tree old_decl = NULL_TREE;

        if (INHERITED_VALUE_BINDING_P (binding))
*************** push_class_level_binding (tree name, tre
*** 2850,2857 ****
  	    {
  	      old_decl = binding->type;
  	      binding->type = bval;
! 	      binding->value.t = NULL_TREE;
! 	      binding->value.st = NULL_S_TREE_I;
  	      INHERITED_VALUE_BINDING_P (binding) = 0;
  	    }
  	  else
--- 2851,2857 ----
  	    {
  	      old_decl = binding->type;
  	      binding->type = bval;
! 	      CXX_BINDING_SET_VALUE (binding, NULL_TREE);
  	      INHERITED_VALUE_BINDING_P (binding) = 0;
  	    }
  	  else
*************** push_class_level_binding (tree name, tre
*** 2878,2884 ****
  	    if (TREE_PURPOSE (shadow) == name
  		&& TREE_TYPE (shadow) == old_decl)
  	      {
! 		binding->value.t = x;
  		INHERITED_VALUE_BINDING_P (binding) = 0;
  		TREE_TYPE (shadow) = x;
  		IDENTIFIER_CLASS_VALUE (name) = x;
--- 2878,2884 ----
  	    if (TREE_PURPOSE (shadow) == name
  		&& TREE_TYPE (shadow) == old_decl)
  	      {
! 		CXX_BINDING_SET_VALUE (binding, x);
  		INHERITED_VALUE_BINDING_P (binding) = 0;
  		TREE_TYPE (shadow) = x;
  		IDENTIFIER_CLASS_VALUE (name) = x;
*************** set_namespace_binding (tree name, tree s
*** 2985,2991 ****
    b = binding_for_name (NAMESPACE_LEVEL (scope), name);
    if (! binding_value_tree (name, b)
        || TREE_CODE (val) == OVERLOAD || val == error_mark_node)
!     b->value.t = val;
    else
      supplement_binding (name, b, val);
    timevar_pop (TV_NAME_LOOKUP);
--- 2985,2991 ----
    b = binding_for_name (NAMESPACE_LEVEL (scope), name);
    if (! binding_value_tree (name, b)
        || TREE_CODE (val) == OVERLOAD || val == error_mark_node)
!     CXX_BINDING_SET_VALUE (b, val);
    else
      supplement_binding (name, b, val);
    timevar_pop (TV_NAME_LOOKUP);
*************** do_toplevel_using_decl (tree decl, tree
*** 3381,3387 ****

    /* Copy declarations found.  */
    if (newval)
!     binding->value.t = newval;
    if (newtype)
      binding->type = newtype;
    return;
--- 3381,3387 ----

    /* Copy declarations found.  */
    if (newval)
!     CXX_BINDING_SET_VALUE (binding, newval);
    if (newtype)
      binding->type = newtype;
    return;
*************** ambiguous_decl (tree name, cxx_binding *
*** 3573,3583 ****
        }

    if (! binding_value_tree (name, old))
!     old->value.t = val;
!   else if (val && val != old->value.t)
      {
!       if (is_overloaded_fn (old->value.t) && is_overloaded_fn (val))
!         old->value.t = merge_functions (old->value.t, val);
        else
  	{
  	  /* Some declarations are functions, some are not.  */
--- 3573,3584 ----
        }

if (! binding_value_tree (name, old))
! CXX_BINDING_SET_VALUE (old, val);
! else if (val && val != CXX_BINDING_VALUE (old))
{
! if (is_overloaded_fn (CXX_BINDING_VALUE (old)) && is_overloaded_fn (val))
! CXX_BINDING_SET_VALUE (old,
! merge_functions (CXX_BINDING_VALUE (old), val));
else
{
/* Some declarations are functions, some are not. */
*************** ambiguous_decl (tree name, cxx_binding *
*** 3586,3600 ****
/* If we've already given this error for this lookup,
old->value.t is error_mark_node, so let's not
repeat ourselves. */
! if (old->value.t != error_mark_node)
{
error ("use of `%D' is ambiguous", name);
cp_error_at (" first declared as `%#D' here",
! old->value.t);
}
cp_error_at (" also declared as `%#D' here", val);
}
! old->value.t = error_mark_node;
}
}
/* ... and copy the type. */
--- 3587,3601 ----
/* If we've already given this error for this lookup,
old->value.t is error_mark_node, so let's not
repeat ourselves. */
! if (CXX_BINDING_VALUE (old) != error_mark_node)
{
error ("use of `%D' is ambiguous", name);
cp_error_at (" first declared as `%#D' here",
! CXX_BINDING_VALUE (old));
}
cp_error_at (" also declared as `%#D' here", val);
}
! CXX_BINDING_SET_VALUE (old, error_mark_node);
}
}
/* ... and copy the type. */
*************** lookup_namespace_name (tree namespace, t
*** 3698,3704 ****


    if (binding_value_tree (name, &binding))
      {
!       val = binding.value.t;

        if (template_id)
  	{
--- 3699,3705 ----

    if (binding_value_tree (name, &binding))
      {
!       val = CXX_BINDING_VALUE (&binding);

if (template_id)
{
*************** unqualified_namespace_lookup (tree name,
*** 3788,3800 ****
cxx_scope_find_binding_for_name (NAMESPACE_LEVEL (scope), name);


/* Ignore anticipated built-in functions. */
! if (b && binding_value_tree (name, b) && DECL_P (b->value.t)
! && DECL_LANG_SPECIFIC (b->value.t) && DECL_ANTICIPATED (b->value.t))
/* Keep binding cleared. */;
else if (b)
{
/* Initialize binding for this context. */
! binding.value.t = b->value.t;
binding.type = b->type;
}


--- 3789,3802 ----
cxx_scope_find_binding_for_name (NAMESPACE_LEVEL (scope), name);


/* Ignore anticipated built-in functions. */
! if (b && binding_value_tree (name, b) && DECL_P (CXX_BINDING_VALUE (b))
! && DECL_LANG_SPECIFIC (CXX_BINDING_VALUE (b))
! && DECL_ANTICIPATED (CXX_BINDING_VALUE (b)))
/* Keep binding cleared. */;
else if (b)
{
/* Initialize binding for this context. */
! CXX_BINDING_SET_VALUE (&binding, CXX_BINDING_VALUE (b));
binding.type = b->type;
}


*************** lookup_using_namespace (tree name, cxx_b
*** 3889,3895 ****
if (val1)
val = ambiguous_decl (name, val, val1, flags);
}
! POP_TIMEVAR_AND_RETURN (TV_NAME_LOOKUP, val->value.t != error_mark_node);
}


  /* [namespace.qual]
--- 3891,3898 ----
          if (val1)
            val = ambiguous_decl (name, val, val1, flags);
        }
!   POP_TIMEVAR_AND_RETURN (TV_NAME_LOOKUP,
! 			  CXX_BINDING_VALUE (val) != error_mark_node);
  }

/* [namespace.qual]
*************** qualified_lookup_using_namespace (tree n
*** 3910,3916 ****
timevar_push (TV_NAME_LOOKUP);
/* Look through namespace aliases. */
scope = ORIGINAL_NAMESPACE (scope);
! while (scope && result->value.t != error_mark_node)
{
cxx_binding *binding =
cxx_scope_find_binding_for_name (NAMESPACE_LEVEL (scope), name);
--- 3913,3919 ----
timevar_push (TV_NAME_LOOKUP);
/* Look through namespace aliases. */
scope = ORIGINAL_NAMESPACE (scope);
! while (scope && CXX_BINDING_VALUE (result) != error_mark_node)
{
cxx_binding *binding =
cxx_scope_find_binding_for_name (NAMESPACE_LEVEL (scope), name);
*************** qualified_lookup_using_namespace (tree n
*** 3936,3942 ****
&& !purpose_member (TREE_PURPOSE (usings), seen)
&& !purpose_member (TREE_PURPOSE (usings), todo))
todo = tree_cons (TREE_PURPOSE (usings), NULL_TREE, todo);
! else if ((!(result->value.t || result->value.st) && !result->type)
&& !purpose_member (TREE_PURPOSE (usings), seen)
&& !purpose_member (TREE_PURPOSE (usings), todo)
&& !purpose_member (TREE_PURPOSE (usings), todo_maybe))
--- 3939,3946 ----
&& !purpose_member (TREE_PURPOSE (usings), seen)
&& !purpose_member (TREE_PURPOSE (usings), todo))
todo = tree_cons (TREE_PURPOSE (usings), NULL_TREE, todo);
! else if ((!(CXX_BINDING_VALUE(result)
! || CXX_BINDING_VALUE_S (result)) && !result->type)
&& !purpose_member (TREE_PURPOSE (usings), seen)
&& !purpose_member (TREE_PURPOSE (usings), todo)
&& !purpose_member (TREE_PURPOSE (usings), todo_maybe))
*************** qualified_lookup_using_namespace (tree n
*** 3949,3955 ****
todo = TREE_CHAIN (todo);
}
else if (todo_maybe
! && !(result->value.t || result->value.st) && !result->type)
{
scope = TREE_PURPOSE (todo_maybe);
todo = TREE_CHAIN (todo_maybe);
--- 3953,3960 ----
todo = TREE_CHAIN (todo);
}
else if (todo_maybe
! && !(CXX_BINDING_VALUE (result) || CXX_BINDING_VALUE_S (result))
! && !result->type)
{
scope = TREE_PURPOSE (todo_maybe);
todo = TREE_CHAIN (todo_maybe);
*************** qualified_lookup_using_namespace (tree n
*** 3958,3964 ****
else
scope = NULL_TREE; /* If there never was a todo list. */
}
! POP_TIMEVAR_AND_RETURN (TV_NAME_LOOKUP, result->value.t != error_mark_node);
}


  /* Look up NAME in the current binding level and its superiors in the
--- 3963,3970 ----
        else
  	scope = NULL_TREE; /* If there never was a todo list.  */
      }
!   POP_TIMEVAR_AND_RETURN (TV_NAME_LOOKUP,
! 			  CXX_BINDING_VALUE (result) != error_mark_node);
  }

  /* Look up NAME in the current binding level and its superiors in the
*************** lookup_name_real (tree name, int prefer_
*** 4028,4034 ****

/* If this is the kind of thing we're looking for, we're done. */
if (qualify_lookup (binding_value_tree (name, iter), flags))
! binding = iter->value.t;
else if ((flags & LOOKUP_PREFER_TYPES)
&& qualify_lookup (iter->type, flags))
binding = iter->type;
--- 4034,4040 ----


/* If this is the kind of thing we're looking for, we're done. */
if (qualify_lookup (binding_value_tree (name, iter), flags))
! binding = CXX_BINDING_VALUE (iter);
else if ((flags & LOOKUP_PREFER_TYPES)
&& qualify_lookup (iter->type, flags))
binding = iter->type;
Index: gcc/cp/name-lookup.h
===================================================================
RCS file: /cvs/gcc/gcc/gcc/cp/name-lookup.h,v
retrieving revision 1.18.2.1
diff -p -r1.18.2.1 name-lookup.h
*** gcc/cp/name-lookup.h 9 Mar 2004 00:41:54 -0000 1.18.2.1
--- gcc/cp/name-lookup.h 14 Apr 2004 01:22:57 -0000
*************** struct cxx_binding GTY(())
*** 76,90 ****
/* Link to chain together various bindings for this name. */
cxx_binding *previous;
/* The non-type entity this name is bound to. */
! struct s_tree_i_or_tree value;
/* The type entity this name is bound to. */
tree type;
/* The scope at which this binding was made. */
cxx_scope *scope;
unsigned value_is_inherited : 1;
unsigned is_local : 1;
};


  extern tree identifier_type_value (tree);
  extern void set_identifier_type_value (tree, tree);
  extern void pop_binding (tree, tree);
--- 76,104 ----
    /* Link to chain together various bindings for this name.  */
    cxx_binding *previous;
    /* The non-type entity this name is bound to.  */
!   union cxx_binding_value_u {
!     tree     GTY ((tag("0"))) t;
!     s_tree_i GTY ((tag("1"))) st;
!   } GTY ((desc ("%1.value_is_s_tree"))) value;
    /* The type entity this name is bound to.  */
    tree type;
    /* The scope at which this binding was made.  */
    cxx_scope *scope;
    unsigned value_is_inherited : 1;
    unsigned is_local : 1;
+   unsigned value_is_s_tree : 1;
  };

+ #define CXX_BINDING_VALUE(NODE) \
+ ((NODE)->value_is_s_tree ? NULL_TREE : (NODE)->value.t)
+ #define CXX_BINDING_SET_VALUE(NODE, VAL) \
+ do { (NODE)->value.t = (VAL); (NODE)->value_is_s_tree = 0; } while (0)
+
+ #define CXX_BINDING_VALUE_S(NODE) \
+ ((NODE)->value_is_s_tree ? (NODE)->value.st : NULL_S_TREE_I)
+ #define CXX_BINDING_SET_VALUE_S(NODE, VAL) \
+ do { (NODE)->value.st = (VAL); (NODE)->value_is_s_tree = 1; } while (0)
+
extern tree identifier_type_value (tree);
extern void set_identifier_type_value (tree, tree);
extern void pop_binding (tree, tree);
*************** is_typename_at_global_scope (tree id)
*** 339,346 ****
static inline tree
binding_value_tree (tree name, cxx_binding *binding)
{
! if (!binding->value.t && binding->value.st)
! binding->value.t = s_tree_to_tree (name, binding->value.st);
return binding->value.t;
}


--- 353,364 ----
  static inline tree
  binding_value_tree (tree name, cxx_binding *binding)
  {
!   if (binding->value_is_s_tree) {
!     tree val = s_tree_to_tree (name, binding->value.st);
!     binding->value.t = val;
!     binding->value_is_s_tree = 0;
!
!   }
    return binding->value.t;
  }



Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]