contrib/gcc/cp/typeck.c
/* Given the TYPE of an anonymous union field inside T, return the
   FIELD_DECL for the field.  If not found return NULL_TREE.  Because
   anonymous unions can nest, we must also search all anonymous unions
   that are directly reachable.  */
Given the TYPE of an anonymous union field inside T, return the
FIELD_DECL for the field.  If not found return NULL_TREE.  Because
anonymous unions can nest, we must also search all anonymous unions
that are directly reachable.
Given the TYPE of an anonymous union field inside T return the FIELD_DECL for the field . If not found return NULL_TREE . Because anonymous unions can nest we must also search all anonymous unions that are directly reachable .
tree
lookup_anon_field (tree t, tree type)
{
  tree field;
  for (field = TYPE_FIELDS (t); field; field = TREE_CHAIN (field))
    {
      if (TREE_STATIC (field))
	continue;
      if (TREE_CODE (field) != FIELD_DECL || DECL_ARTIFICIAL (field))
	continue;
      if (DECL_NAME (field) == NULL_TREE
	  && type == TYPE_MAIN_VARIANT (TREE_TYPE (field)))
	{
	  return field;
	}
      if (DECL_NAME (field) == NULL_TREE
	  && ANON_AGGR_TYPE_P (TREE_TYPE (field)))
	{
	  tree subfield = lookup_anon_field (TREE_TYPE (field), type);
	  if (subfield)
	    return subfield;
	}
    }
  return NULL_TREE;
}
tree lookup_anon_field ( tree t , tree type ) { tree field ; for ( field = TYPE_FIELDS ( t ) ; field ; field = TREE_CHAIN ( field ) ) { if ( TREE_STATIC ( field ) ) continue ; if ( TREE_CODE ( field ) != FIELD_DECL || DECL_ARTIFICIAL ( field ) ) continue ; if ( DECL_NAME ( field ) == NULL_TREE && type == TYPE_MAIN_VARIANT ( TREE_TYPE ( field ) ) ) { return field ; } if ( DECL_NAME ( field ) == NULL_TREE && ANON_AGGR_TYPE_P ( TREE_TYPE ( field ) ) ) { tree subfield = lookup_anon_field ( TREE_TYPE ( field ) , type ) ; if ( subfield ) return subfield ; } } return NULL_TREE ; }
Given the TYPE of an anonymous union field inside T, return the
FIELD_DECL for the field.
Given the TYPE of an anonymous union field inside T return the FIELD_DECL for the field .
/* If we find it directly, return the field.  */ /* Otherwise, it could be nested, search harder.  */