FreeBSD/contrib/gcc/cp/class.c
/* Build the VTT (virtual table table) for T.
   A class requires a VTT if it has virtual bases.

   This holds
   1 - primary virtual pointer for complete object T
   2 - secondary VTTs for each direct non-virtual base of T which requires a
       VTT
   3 - secondary virtual pointers for each direct or indirect base of T which
       has virtual bases or is reachable via a virtual path from T.
   4 - secondary VTTs for each direct or indirect virtual base of T.

   Secondary VTTs look like complete object VTTs without part 4.  */
Build the VTT (virtual table table) for T.
A class requires a VTT if it has virtual bases.

This holds
1 - primary virtual pointer for complete object T
2 - secondary VTTs for each direct non-virtual base of T which requires a
VTT
3 - secondary virtual pointers for each direct or indirect base of T which
has virtual bases or is reachable via a virtual path from T.
4 - secondary VTTs for each direct or indirect virtual base of T.

Secondary VTTs look like complete object VTTs without part 4.
Build the VTT ( virtual table table ) for T . A class requires a VTT if it has virtual bases . This holds 1 - primary virtual pointer for complete object T 2 - secondary VTTs for each direct non - virtual base of T which requires a VTT 3 - secondary virtual pointers for each direct or indirect base of T which has virtual bases or is reachable via a virtual path from T . 4 - secondary VTTs for each direct or indirect virtual base of T . Secondary VTTs look like complete object VTTs without part 4 .
static void
build_vtt (tree t)
{
  tree inits;
  tree type;
  tree vtt;
  tree index;
  inits = NULL_TREE;
  index = size_zero_node;
  build_vtt_inits (TYPE_BINFO (t), t, &inits, &index);
  if (!inits)
    return;
  type = build_index_type (size_int (list_length (inits) - 1));
  type = build_cplus_array_type (const_ptr_type_node, type);
  vtt = build_vtable (t, mangle_vtt_for_type (t), type);
  initialize_artificial_var (vtt, inits);
  TREE_CHAIN (vtt) = TREE_CHAIN (CLASSTYPE_VTABLES (t));
  TREE_CHAIN (CLASSTYPE_VTABLES (t)) = vtt;
  dump_vtt (t, vtt);
}
static void build_vtt ( tree t ) { tree inits ; tree type ; tree vtt ; tree index ; inits = NULL_TREE ; index = size_zero_node ; build_vtt_inits ( TYPE_BINFO ( t ) , t , & inits , & index ) ; if ( ! inits ) return ; type = build_index_type ( size_int ( list_length ( inits ) - 1 ) ) ; type = build_cplus_array_type ( const_ptr_type_node , type ) ; vtt = build_vtable ( t , mangle_vtt_for_type ( t ) , type ) ; initialize_artificial_var ( vtt , inits ) ; TREE_CHAIN ( vtt ) = TREE_CHAIN ( CLASSTYPE_VTABLES ( t ) ) ; TREE_CHAIN ( CLASSTYPE_VTABLES ( t ) ) = vtt ; dump_vtt ( t , vtt ) ; }
Build the VTT (virtual table table) for T.
A class requires a VTT if it has virtual bases.
Build the VTT ( virtual table table ) for T . A class requires a VTT if it has virtual bases .
/* Build up the initializers for the VTT.  */ /* If we didn't need a VTT, we're done.  */ /* Figure out the type of the VTT.  */ /* Now, build the VTT object itself.  */ /* Add the VTT to the vtables list.  */