FreeBSD/contrib/gcc/cp/name-lookup.c
/* Return whether FN is a friend of an associated class of ARG.  */
Return whether FN is a friend of an associated class of ARG.
Return whether FN is a friend of an associated class of ARG .
static bool
friend_of_associated_class_p (tree arg, tree fn)
{
  tree type;
  if (TYPE_P (arg))
    type = arg;
  else if (type_unknown_p (arg))
    return false;
  else
    type = TREE_TYPE (arg);
  if (CLASS_TYPE_P (type))
    {
      if (is_friend (type, fn))
	return true;
      if (TYPE_BINFO (type))
	{
	  tree binfo, base_binfo;
	  int i;
	  for (binfo = TYPE_BINFO (type), i = 0;
	       BINFO_BASE_ITERATE (binfo, i, base_binfo);
	       i++)
	    if (is_friend (BINFO_TYPE (base_binfo), fn))
	      return true;
	}
    }
  if ((CLASS_TYPE_P (type)
       || TREE_CODE (type) == UNION_TYPE
       || TREE_CODE (type) == ENUMERAL_TYPE)
      && TYPE_CONTEXT (type)
      && CLASS_TYPE_P (TYPE_CONTEXT (type))
      && is_friend (TYPE_CONTEXT (type), fn))
    return true;
  return false;
}
static bool friend_of_associated_class_p ( tree arg , tree fn ) { tree type ; if ( TYPE_P ( arg ) ) type = arg ; else if ( type_unknown_p ( arg ) ) return false ; else type = TREE_TYPE ( arg ) ; if ( CLASS_TYPE_P ( type ) ) { if ( is_friend ( type , fn ) ) return true ; if ( TYPE_BINFO ( type ) ) { tree binfo , base_binfo ; int i ; for ( binfo = TYPE_BINFO ( type ) , i = 0 ; BINFO_BASE_ITERATE ( binfo , i , base_binfo ) ; i ++ ) if ( is_friend ( BINFO_TYPE ( base_binfo ) , fn ) ) return true ; } } if ( ( CLASS_TYPE_P ( type ) || TREE_CODE ( type ) == UNION_TYPE || TREE_CODE ( type ) == ENUMERAL_TYPE ) && TYPE_CONTEXT ( type ) && CLASS_TYPE_P ( TYPE_CONTEXT ( type ) ) && is_friend ( TYPE_CONTEXT ( type ) , fn ) ) return true ; return false ; }
Return whether FN is a friend of an associated class of ARG.
Return whether FN is a friend of an associated class of ARG .
/* If TYPE is a class, the class itself and all base classes are
     associated classes.  */ /* If TYPE is a class member, the class of which it is a member is
     an associated class.  */