FreeBSD/contrib/gcc/cp/class.c
/* Subroutine of build_base_path; EXPR and BINFO are as in that function.
   Perform a derived-to-base conversion by recursively building up a
   sequence of COMPONENT_REFs to the appropriate base fields.  */
Subroutine of build_base_path; EXPR and BINFO are as in that function.
Perform a derived-to-base conversion by recursively building up a
sequence of COMPONENT_REFs to the appropriate base fields.
Subroutine of build_base_path ; EXPR and BINFO are as in that function . Perform a derived - to - base conversion by recursively building up a sequence of COMPONENT_REFs to the appropriate base fields .
static tree
build_simple_base_path (tree expr, tree binfo)
{
  tree type = BINFO_TYPE (binfo);
  tree d_binfo = BINFO_INHERITANCE_CHAIN (binfo);
  tree field;
  if (d_binfo == NULL_TREE)
    {
      tree temp;
      gcc_assert (TYPE_MAIN_VARIANT (TREE_TYPE (expr)) == type);
      temp = unary_complex_lvalue (ADDR_EXPR, expr);
      if (temp)
	expr = build_indirect_ref (temp, NULL);
      return expr;
    }
  expr = build_simple_base_path (expr, d_binfo);
  for (field = TYPE_FIELDS (BINFO_TYPE (d_binfo));
       field; field = TREE_CHAIN (field))
    if (TREE_CODE (field) == FIELD_DECL
	&& DECL_FIELD_IS_BASE (field)
	&& TREE_TYPE (field) == type)
      {
	int type_quals = cp_type_quals (TREE_TYPE (expr));
	expr = build3 (COMPONENT_REF,
		       cp_build_qualified_type (type, type_quals),
		       expr, field, NULL_TREE);
	expr = fold_if_not_in_template (expr);
	if (type_quals & TYPE_QUAL_CONST)
	  TREE_READONLY (expr) = 1;
	if (type_quals & TYPE_QUAL_VOLATILE)
	  TREE_THIS_VOLATILE (expr) = 1;
	return expr;
      }
  gcc_unreachable ();
}
static tree build_simple_base_path ( tree expr , tree binfo ) { tree type = BINFO_TYPE ( binfo ) ; tree d_binfo = BINFO_INHERITANCE_CHAIN ( binfo ) ; tree field ; if ( d_binfo == NULL_TREE ) { tree temp ; gcc_assert ( TYPE_MAIN_VARIANT ( TREE_TYPE ( expr ) ) == type ) ; temp = unary_complex_lvalue ( ADDR_EXPR , expr ) ; if ( temp ) expr = build_indirect_ref ( temp , NULL ) ; return expr ; } expr = build_simple_base_path ( expr , d_binfo ) ; for ( field = TYPE_FIELDS ( BINFO_TYPE ( d_binfo ) ) ; field ; field = TREE_CHAIN ( field ) ) if ( TREE_CODE ( field ) == FIELD_DECL && DECL_FIELD_IS_BASE ( field ) && TREE_TYPE ( field ) == type ) { int type_quals = cp_type_quals ( TREE_TYPE ( expr ) ) ; expr = build3 ( COMPONENT_REF , cp_build_qualified_type ( type , type_quals ) , expr , field , NULL_TREE ) ; expr = fold_if_not_in_template ( expr ) ; if ( type_quals & TYPE_QUAL_CONST ) TREE_READONLY ( expr ) = 1 ; if ( type_quals & TYPE_QUAL_VOLATILE ) TREE_THIS_VOLATILE ( expr ) = 1 ; return expr ; } gcc_unreachable ( ) ; }
Subroutine of build_base_path; EXPR and BINFO are as in that function.
Subroutine of build_base_path ; EXPR and BINFO are as in that function .
/* Transform `(a, b).x' into `(*(a, &b)).x', `(a ? b : c).x'
	 into `(*(a ?  &b : &c)).x', and so on.  A COND_EXPR is only
	 an lvalue in the frontend; only _DECLs and _REFs are lvalues
	 in the backend.  */ /* Recurse.  */ /* Is this the base field created by build_base_field?  */ /* We don't use build_class_member_access_expr here, as that
	   has unnecessary checks, and more importantly results in
	   recursive calls to dfs_walk_once.  */ /* Mark the expression const or volatile, as appropriate.
	   Even though we've dealt with the type above, we still have
	   to mark the expression itself.  */ /* Didn't find the base field?!?  */