FreeBSD/contrib/gcc/cp/name-lookup.c
/* Like pushdecl, only it places X in the current namespace,
   if appropriate.  */
Like pushdecl, only it places X in the current namespace,
if appropriate.
Like pushdecl only it places X in the current namespace if appropriate .
tree
pushdecl_namespace_level (tree x, bool is_friend)
{
  struct cp_binding_level *b = current_binding_level;
  tree t;
  timevar_push (TV_NAME_LOOKUP);
  t = pushdecl_with_scope (x, NAMESPACE_LEVEL (current_namespace), is_friend);
  if (TREE_CODE (t) == TYPE_DECL)
    {
      tree name = DECL_NAME (t);
      tree newval;
      tree *ptr = (tree *)0;
      for (; !global_scope_p (b); b = b->level_chain)
	{
	  tree shadowed = b->type_shadowed;
	  for (; shadowed; shadowed = TREE_CHAIN (shadowed))
	    if (TREE_PURPOSE (shadowed) == name)
	      {
		ptr = &TREE_VALUE (shadowed);
	      }
	}
      newval = TREE_TYPE (t);
      if (ptr == (tree *)0)
	{
	  SET_IDENTIFIER_TYPE_VALUE (name, t);
	}
      else
	{
	  *ptr = newval;
	}
    }
  POP_TIMEVAR_AND_RETURN (TV_NAME_LOOKUP, t);
}
tree pushdecl_namespace_level ( tree x , bool is_friend ) { struct cp_binding_level * b = current_binding_level ; tree t ; timevar_push ( TV_NAME_LOOKUP ) ; t = pushdecl_with_scope ( x , NAMESPACE_LEVEL ( current_namespace ) , is_friend ) ; if ( TREE_CODE ( t ) == TYPE_DECL ) { tree name = DECL_NAME ( t ) ; tree newval ; tree * ptr = ( tree * ) 0 ; for ( ; ! global_scope_p ( b ) ; b = b -> level_chain ) { tree shadowed = b -> type_shadowed ; for ( ; shadowed ; shadowed = TREE_CHAIN ( shadowed ) ) if ( TREE_PURPOSE ( shadowed ) == name ) { ptr = & TREE_VALUE ( shadowed ) ; } } newval = TREE_TYPE ( t ) ; if ( ptr == ( tree * ) 0 ) { SET_IDENTIFIER_TYPE_VALUE ( name , t ) ; } else { * ptr = newval ; } } POP_TIMEVAR_AND_RETURN ( TV_NAME_LOOKUP , t ) ; }
Like pushdecl, only it places X in the current namespace,
if appropriate.
Like pushdecl only it places X in the current namespace if appropriate .
/* Now, the type_shadowed stack may screw us.  Munge it so it does
     what we want.  */ /* Can't break out of the loop here because sometimes
		   a binding level will have duplicate bindings for
		   PT names.  It's gross, but I haven't time to fix it.  */ /* @@ This shouldn't be needed.  My test case "zstring.cc" trips
	     up here if this is changed to an assertion.  --KR  */