FreeBSD/contrib/gcc/cp/class.c
/* Given an object INSTANCE, return an expression which yields the
   vtable element corresponding to INDEX.  There are many special
   cases for INSTANCE which we take care of here, mainly to avoid
   creating extra tree nodes when we don't have to.  */
Given an object INSTANCE, return an expression which yields the
vtable element corresponding to INDEX.  There are many special
cases for INSTANCE which we take care of here, mainly to avoid
creating extra tree nodes when we don't have to.
Given an object INSTANCE return an expression which yields the vtable element corresponding to INDEX . There are many special cases for INSTANCE which we take care of here mainly to avoid creating extra tree nodes when we don ' t have to .
static tree
build_vtbl_ref_1 (tree instance, tree idx)
{
  tree aref;
  tree vtbl = NULL_TREE;
  int cdtorp = 0;
  tree fixed_type = fixed_type_or_null (instance, NULL, &cdtorp);
  tree basetype = non_reference (TREE_TYPE (instance));
  if (fixed_type && !cdtorp)
    {
      tree binfo = lookup_base (fixed_type, basetype,
				ba_unique | ba_quiet, NULL);
      if (binfo)
	vtbl = unshare_expr (BINFO_VTABLE (binfo));
    }
  if (!vtbl)
    vtbl = build_vfield_ref (instance, basetype);
  assemble_external (vtbl);
  aref = build_array_ref (vtbl, idx);
  TREE_CONSTANT (aref) |= TREE_CONSTANT (vtbl) && TREE_CONSTANT (idx);
  TREE_INVARIANT (aref) = TREE_CONSTANT (aref);
  return aref;
}
static tree build_vtbl_ref_1 ( tree instance , tree idx ) { tree aref ; tree vtbl = NULL_TREE ; int cdtorp = 0 ; tree fixed_type = fixed_type_or_null ( instance , NULL , & cdtorp ) ; tree basetype = non_reference ( TREE_TYPE ( instance ) ) ; if ( fixed_type && ! cdtorp ) { tree binfo = lookup_base ( fixed_type , basetype , ba_unique | ba_quiet , NULL ) ; if ( binfo ) vtbl = unshare_expr ( BINFO_VTABLE ( binfo ) ) ; } if ( ! vtbl ) vtbl = build_vfield_ref ( instance , basetype ) ; assemble_external ( vtbl ) ; aref = build_array_ref ( vtbl , idx ) ; TREE_CONSTANT ( aref ) |= TREE_CONSTANT ( vtbl ) && TREE_CONSTANT ( idx ) ; TREE_INVARIANT ( aref ) = TREE_CONSTANT ( aref ) ; return aref ; }
Given an object INSTANCE, return an expression which yields the
vtable element corresponding to INDEX.
Given an object INSTANCE return an expression which yields the vtable element corresponding to INDEX .
/* Try to figure out what a reference refers to, and
     access its virtual function table directly.  */