FreeBSD/contrib/gcc/cp/class.c
/* Return vtbl initializers for the RTTI entries corresponding to the
   BINFO's vtable.  The RTTI entries should indicate the object given
   by VID->rtti_binfo.  */
Return vtbl initializers for the RTTI entries corresponding to the
BINFO's vtable.  The RTTI entries should indicate the object given
by VID->rtti_binfo.
Return vtbl initializers for the RTTI entries corresponding to the BINFO ' s vtable . The RTTI entries should indicate the object given by VID - > rtti_binfo .
static void
build_rtti_vtbl_entries (tree binfo, vtbl_init_data* vid)
{
  tree b;
  tree t;
  tree basetype;
  tree offset;
  tree decl;
  tree init;
  basetype = BINFO_TYPE (binfo);
  t = BINFO_TYPE (vid->rtti_binfo);
  b = binfo;
  while (CLASSTYPE_HAS_PRIMARY_BASE_P (BINFO_TYPE (b))
	 && !BINFO_LOST_PRIMARY_P (b))
    {
      tree primary_base;
      primary_base = get_primary_binfo (b);
      gcc_assert (BINFO_PRIMARY_P (primary_base)
		  && BINFO_INHERITANCE_CHAIN (primary_base) == b);
      b = primary_base;
    }
  offset = size_diffop (BINFO_OFFSET (vid->rtti_binfo), BINFO_OFFSET (b));
  if (flag_rtti)
    decl = build_address (get_tinfo_decl (t));
  else
    decl = integer_zero_node;
  init = build_nop (vfunc_ptr_type_node, decl);
  *vid->last_init = build_tree_list (NULL_TREE, init);
  vid->last_init = &TREE_CHAIN (*vid->last_init);
  init = build_nop (vfunc_ptr_type_node, offset);
  *vid->last_init = build_tree_list (NULL_TREE, init);
  vid->last_init = &TREE_CHAIN (*vid->last_init);
}
static void build_rtti_vtbl_entries ( tree binfo , vtbl_init_data * vid ) { tree b ; tree t ; tree basetype ; tree offset ; tree decl ; tree init ; basetype = BINFO_TYPE ( binfo ) ; t = BINFO_TYPE ( vid -> rtti_binfo ) ; b = binfo ; while ( CLASSTYPE_HAS_PRIMARY_BASE_P ( BINFO_TYPE ( b ) ) && ! BINFO_LOST_PRIMARY_P ( b ) ) { tree primary_base ; primary_base = get_primary_binfo ( b ) ; gcc_assert ( BINFO_PRIMARY_P ( primary_base ) && BINFO_INHERITANCE_CHAIN ( primary_base ) == b ) ; b = primary_base ; } offset = size_diffop ( BINFO_OFFSET ( vid -> rtti_binfo ) , BINFO_OFFSET ( b ) ) ; if ( flag_rtti ) decl = build_address ( get_tinfo_decl ( t ) ) ; else decl = integer_zero_node ; init = build_nop ( vfunc_ptr_type_node , decl ) ; * vid -> last_init = build_tree_list ( NULL_TREE , init ) ; vid -> last_init = & TREE_CHAIN ( * vid -> last_init ) ; init = build_nop ( vfunc_ptr_type_node , offset ) ; * vid -> last_init = build_tree_list ( NULL_TREE , init ) ; vid -> last_init = & TREE_CHAIN ( * vid -> last_init ) ; }
Return vtbl initializers for the RTTI entries corresponding to the
BINFO's vtable.
Return vtbl initializers for the RTTI entries corresponding to the BINFO ' s vtable .
/* To find the complete object, we will first convert to our most
     primary base, and then add the offset in the vtbl to that value.  */ /* The second entry is the address of the typeinfo object.  */ /* Convert the declaration to a type that can be stored in the
     vtable.  */ /* Add the offset-to-top entry.  It comes earlier in the vtable than
     the typeinfo entry.  Convert the offset to look like a
     function pointer, so that we can put it in the vtable.  */