FreeBSD/contrib/gcc/cp/class.c
/* Adds the initializers for the vcall offset entries in the vtable
   for BINFO (which is part of the class hierarchy dominated by VID->DERIVED)
   to VID->INITS.  */
Adds the initializers for the vcall offset entries in the vtable
for BINFO (which is part of the class hierarchy dominated by VID->DERIVED)
to VID->INITS.
Adds the initializers for the vcall offset entries in the vtable for BINFO ( which is part of the class hierarchy dominated by VID - > DERIVED ) to VID - > INITS .
static void
build_vcall_offset_vtbl_entries (tree binfo, vtbl_init_data* vid)
{
  if (BINFO_VIRTUAL_P (binfo) || binfo == TYPE_BINFO (vid->derived))
    {
      vid->vbase = binfo;
      if (!BINFO_VIRTUAL_P (binfo))
	vid->generate_vcall_entries = false;
      add_vcall_offset_vtbl_entries_r (binfo, vid);
    }
}
static void build_vcall_offset_vtbl_entries ( tree binfo , vtbl_init_data * vid ) { if ( BINFO_VIRTUAL_P ( binfo ) || binfo == TYPE_BINFO ( vid -> derived ) ) { vid -> vbase = binfo ; if ( ! BINFO_VIRTUAL_P ( binfo ) ) vid -> generate_vcall_entries = false ; add_vcall_offset_vtbl_entries_r ( binfo , vid ) ; } }
Adds the initializers for the vcall offset entries in the vtable
for BINFO (which is part of the class hierarchy dominated by VID->DERIVED)
to VID->INITS.
Adds the initializers for the vcall offset entries in the vtable for BINFO ( which is part of the class hierarchy dominated by VID - > DERIVED ) to VID - > INITS .
/* We only need these entries if this base is a virtual base.  We
     compute the indices -- but do not add to the vtable -- when
     building the main vtable for a class.  */ /* We need a vcall offset for each of the virtual functions in this
	 vtable.  For example:

	   class A { virtual void f (); };
	   class B1 : virtual public A { virtual void f (); };
	   class B2 : virtual public A { virtual void f (); };
	   class C: public B1, public B2 { virtual void f (); };

	 A C object has a primary base of B1, which has a primary base of A.  A
	 C also has a secondary base of B2, which no longer has a primary base
	 of A.  So the B2-in-C construction vtable needs a secondary vtable for
	 A, which will adjust the A* to a B2* to call f.  We have no way of
	 knowing what (or even whether) this offset will be when we define B2,
	 so we store this "vcall offset" in the A sub-vtable and look it up in
	 a "virtual thunk" for B2::f.

	 We need entries for all the functions in our primary vtable and
	 in our non-virtual bases' secondary vtables.  */ /* If we are just computing the vcall indices -- but do not need
	 the actual entries -- not that.  */ /* Now, walk through the non-virtual bases, adding vcall offsets.  */