FreeBSD/contrib/gcc/cp/class.c
/* Create default constructors, assignment operators, and so forth for
   the type indicated by T, if they are needed.  CANT_HAVE_CONST_CTOR,
   and CANT_HAVE_CONST_ASSIGNMENT are nonzero if, for whatever reason,
   the class cannot have a default constructor, copy constructor
   taking a const reference argument, or an assignment operator taking
   a const reference, respectively.  */
Create default constructors, assignment operators, and so forth for
the type indicated by T, if they are needed.  CANT_HAVE_CONST_CTOR,
and CANT_HAVE_CONST_ASSIGNMENT are nonzero if, for whatever reason,
the class cannot have a default constructor, copy constructor
taking a const reference argument, or an assignment operator taking
a const reference, respectively.
Create default constructors assignment operators and so forth for the type indicated by T if they are needed . CANT_HAVE_CONST_CTOR and CANT_HAVE_CONST_ASSIGNMENT are nonzero if for whatever reason the class cannot have a default constructor copy constructor taking a const reference argument or an assignment operator taking a const reference respectively .
static void
add_implicitly_declared_members (tree t,
				 int cant_have_const_cctor,
				 int cant_have_const_assignment)
{
  if (!CLASSTYPE_DESTRUCTORS (t))
    {
      CLASSTYPE_LAZY_DESTRUCTOR (t) = 1;
      if (TYPE_HAS_NONTRIVIAL_DESTRUCTOR (t))
	{
	  bool lazy_p = true;
	  CLASSTYPE_DESTRUCTOR_NONTRIVIAL_BECAUSE_OF_BASE (t) = 1;
	  if (TYPE_FOR_JAVA (t))
	    lazy_p = false;
	  else
	    {
	      tree binfo;
	      tree base_binfo;
	      int ix;
	      binfo = TYPE_BINFO (t);
	      for (ix = 0; BINFO_BASE_ITERATE (binfo, ix, base_binfo); ix++)
		{
		  tree base_type;
		  tree dtor;
		  base_type = BINFO_TYPE (base_binfo);
		  dtor = CLASSTYPE_DESTRUCTORS (base_type);
		  if (dtor && DECL_VIRTUAL_P (dtor))
		    {
		      lazy_p = false;
		      break;
		    }
		}
	    }
	  if (!lazy_p)
	    lazily_declare_fn (sfk_destructor, t);
	}
    }
  if (! TYPE_HAS_CONSTRUCTOR (t))
    {
      TYPE_HAS_DEFAULT_CONSTRUCTOR (t) = 1;
      CLASSTYPE_LAZY_DEFAULT_CTOR (t) = 1;
    }
  if (! TYPE_HAS_INIT_REF (t) && ! TYPE_FOR_JAVA (t))
    {
      TYPE_HAS_INIT_REF (t) = 1;
      TYPE_HAS_CONST_INIT_REF (t) = !cant_have_const_cctor;
      CLASSTYPE_LAZY_COPY_CTOR (t) = 1;
      TYPE_HAS_CONSTRUCTOR (t) = 1;
    }
  if (!TYPE_HAS_ASSIGN_REF (t) && !TYPE_FOR_JAVA (t))
    {
      TYPE_HAS_ASSIGN_REF (t) = 1;
      TYPE_HAS_CONST_ASSIGN_REF (t) = !cant_have_const_assignment;
      CLASSTYPE_LAZY_ASSIGNMENT_OP (t) = 1;
    }
}
static void add_implicitly_declared_members ( tree t , int cant_have_const_cctor , int cant_have_const_assignment ) { if ( ! CLASSTYPE_DESTRUCTORS ( t ) ) { CLASSTYPE_LAZY_DESTRUCTOR ( t ) = 1 ; if ( TYPE_HAS_NONTRIVIAL_DESTRUCTOR ( t ) ) { bool lazy_p = true ; CLASSTYPE_DESTRUCTOR_NONTRIVIAL_BECAUSE_OF_BASE ( t ) = 1 ; if ( TYPE_FOR_JAVA ( t ) ) lazy_p = false ; else { tree binfo ; tree base_binfo ; int ix ; binfo = TYPE_BINFO ( t ) ; for ( ix = 0 ; BINFO_BASE_ITERATE ( binfo , ix , base_binfo ) ; ix ++ ) { tree base_type ; tree dtor ; base_type = BINFO_TYPE ( base_binfo ) ; dtor = CLASSTYPE_DESTRUCTORS ( base_type ) ; if ( dtor && DECL_VIRTUAL_P ( dtor ) ) { lazy_p = false ; break ; } } } if ( ! lazy_p ) lazily_declare_fn ( sfk_destructor , t ) ; } } if ( ! TYPE_HAS_CONSTRUCTOR ( t ) ) { TYPE_HAS_DEFAULT_CONSTRUCTOR ( t ) = 1 ; CLASSTYPE_LAZY_DEFAULT_CTOR ( t ) = 1 ; } if ( ! TYPE_HAS_INIT_REF ( t ) && ! TYPE_FOR_JAVA ( t ) ) { TYPE_HAS_INIT_REF ( t ) = 1 ; TYPE_HAS_CONST_INIT_REF ( t ) = ! cant_have_const_cctor ; CLASSTYPE_LAZY_COPY_CTOR ( t ) = 1 ; TYPE_HAS_CONSTRUCTOR ( t ) = 1 ; } if ( ! TYPE_HAS_ASSIGN_REF ( t ) && ! TYPE_FOR_JAVA ( t ) ) { TYPE_HAS_ASSIGN_REF ( t ) = 1 ; TYPE_HAS_CONST_ASSIGN_REF ( t ) = ! cant_have_const_assignment ; CLASSTYPE_LAZY_ASSIGNMENT_OP ( t ) = 1 ; } }
Create default constructors, assignment operators, and so forth for
the type indicated by T, if they are needed.
Create default constructors assignment operators and so forth for the type indicated by T if they are needed .
/* Destructor.  */ /* In general, we create destructors lazily.  */ /* However, if the implicit destructor is non-trivial
	 destructor, we sometimes have to create it at this point.  */ /* APPLE LOCAL begin omit calls to empty destructors 5559195 */ /* Since this is an empty destructor, it can only be nontrivial
	     because one of its base classes has a destructor that must be
	     called. */ /* APPLE LOCAL end omit calls to empty destructors 5559195 */ /* If this a Java class, any non-trivial destructor is
	       invalid, even if compiler-generated.  Therefore, if the
	       destructor is non-trivial we create it now.  */ /* If the implicit destructor will be virtual, then we must
		 generate it now because (unfortunately) we do not
		 generate virtual tables lazily.  */ /* If we can't get away with being lazy, generate the destructor
	     now.  */ /* Default constructor.  */ /* Copy constructor.  */ /* If there is no assignment operator, one will be created if and
     when it is needed.  For now, just record whether or not the type
     of the parameter to the assignment operator will be a const or
     non-const reference.  */