}
TYPE_NONCOPIED_PARTS (t) = tree_cons (NULL_TREE, decl, TYPE_NONCOPIED_PARTS (t)); TREE_STATIC (TYPE_NONCOPIED_PARTS (t)) = 1; }
finish_struct_1 (t, warn_anon)     tree t;     int warn_anon;{  int old;  enum tree_code code = TREE_CODE (t);  tree fields = TYPE_FIELDS (t);  tree x, last_x, method_vec;  int has_virtual;  int max_has_virtual;  tree pending_virtuals = NULL_TREE;  tree pending_hard_virtuals = NULL_TREE;  tree abstract_virtuals = NULL_TREE;  tree vfield;  tree vfields;  tree virtual_dtor;  int cant_have_default_ctor;  int cant_have_const_ctor;  int no_const_asn_ref;  int has_mutable = 0;  /* The index of the first base class which has virtual     functions.  Only applied to non-virtual baseclasses.  */  int first_vfn_base_index;  int n_baseclasses;  int any_default_members = 0;  int const_sans_init = 0;  int ref_sans_init = 0;  tree access_decls = NULL_TREE;  int aggregate = 1;  int empty = 1;  int has_pointers = 0;  if (warn_anon && code != UNION_TYPE && ANON_AGGRNAME_P (TYPE_IDENTIFIER (t)))    pedwarn ("anonymous class type not used to declare any objects");  if (TYPE_SIZE (t))    {      if (IS_AGGR_TYPE (t))	cp_error ("redefinition of `%#T'", t);      else	my_friendly_abort (172);      popclass ();      return;    }  GNU_xref_decl (current_function_decl, t);  /* If this type was previously laid out as a forward reference,     make sure we lay it out again.  */  TYPE_SIZE (t) = NULL_TREE;  CLASSTYPE_GOT_SEMICOLON (t) = 0;#if 0  /* This is in general too late to do this.  I moved the main case up to     left_curly, what else needs to move?  */  if (! IS_SIGNATURE (t))    {      my_friendly_assert (CLASSTYPE_INTERFACE_ONLY (t) == interface_only, 999);      my_friendly_assert (CLASSTYPE_INTERFACE_KNOWN (t) == ! interface_unknown, 999);    }#endif  old = suspend_momentary ();  /* Install struct as DECL_FIELD_CONTEXT of each field decl.     Also process specified field sizes.     Set DECL_FIELD_SIZE to the specified size, or 0 if none specified.     The specified size is found in the DECL_INITIAL.     Store 0 there, except for ": 0" fields (so we can find them     and delete them, below).  */  if (TYPE_BINFO_BASETYPES (t))    n_baseclasses = TREE_VEC_LENGTH (TYPE_BINFO_BASETYPES (t));  else    n_baseclasses = 0;  if (n_baseclasses > 0)    {      struct base_info base_info;      first_vfn_base_index = finish_base_struct (t, &base_info);      /* Remember where we got our vfield from.  */      CLASSTYPE_VFIELD_PARENT (t) = first_vfn_base_index;      has_virtual = base_info.has_virtual;      max_has_virtual = base_info.max_has_virtual;      vfield = base_info.vfield;      vfields = base_info.vfields;      CLASSTYPE_RTTI (t) = base_info.rtti;      cant_have_default_ctor = base_info.cant_have_default_ctor;      cant_have_const_ctor = base_info.cant_have_const_ctor;      no_const_asn_ref = base_info.no_const_asn_ref;      aggregate = 0;    }  else    {      first_vfn_base_index = -1;      has_virtual = 0;      max_has_virtual = has_virtual;      vfield = NULL_TREE;      vfields = NULL_TREE;      CLASSTYPE_RTTI (t) = NULL_TREE;      cant_have_default_ctor = 0;      cant_have_const_ctor = 0;      no_const_asn_ref = 0;    }#if 0  /* Both of these should be done before now.  */  if (write_virtuals == 3 && CLASSTYPE_INTERFACE_KNOWN (t)      && ! IS_SIGNATURE (t))    {      my_friendly_assert (CLASSTYPE_INTERFACE_ONLY (t) == interface_only, 999);      my_friendly_assert (CLASSTYPE_VTABLE_NEEDS_WRITING (t) == ! interface_only, 999);    }#endif  /* The three of these are approximations which may later be     modified.  Needed at this point to make add_virtual_function     and modify_vtable_entries work.  */  CLASSTYPE_VFIELDS (t) = vfields;  CLASSTYPE_VFIELD (t) = vfield;  for (x = TYPE_METHODS (t); x; x = TREE_CHAIN (x))    {      GNU_xref_member (current_class_name, x);      /* If this was an evil function, don't keep it in class.  */      if (IDENTIFIER_ERROR_LOCUS (DECL_ASSEMBLER_NAME (x)))	continue;      /* Do both of these, even though they're in the same union;	 if the insn `r' member and the size `i' member are	 different sizes, as on the alpha, the larger of the two	 will end up with garbage in it.  */      DECL_SAVED_INSNS (x) = NULL_RTX;      DECL_FIELD_SIZE (x) = 0;      check_for_override (x, t);      if (DECL_ABSTRACT_VIRTUAL_P (x) && ! DECL_VINDEX (x))	cp_error_at ("initializer specified for non-virtual method `%D'", x);      /* The name of the field is the original field name	 Save this in auxiliary field for later overloading.  */      if (DECL_VINDEX (x))	{	  add_virtual_function (&pending_virtuals, &pending_hard_virtuals,				&has_virtual, x, t);	  if (DECL_ABSTRACT_VIRTUAL_P (x))	    abstract_virtuals = tree_cons (NULL_TREE, x, abstract_virtuals);#if 0	  /* XXX Why did I comment this out?  (jason) */	  else	    TREE_USED (x) = 1;#endif	}    }  if (n_baseclasses)    fields = chainon (build_vbase_pointer_fields (t), fields);  last_x = NULL_TREE;  for (x = fields; x; x = TREE_CHAIN (x))    {      GNU_xref_member (current_class_name, x);      if (TREE_CODE (x) == FIELD_DECL)	{	  DECL_PACKED (x) |= TYPE_PACKED (t);	  if (DECL_C_BIT_FIELD (x) && integer_zerop (DECL_INITIAL (x)))	    /* A zero-width bitfield doesn't do the trick.  */;	  else	    empty = 0;	}      if (TREE_CODE (x) == USING_DECL)	{	  /* Save access declarations for later.  */	  if (last_x)	    TREE_CHAIN (last_x) = TREE_CHAIN (x);	  else	    fields = TREE_CHAIN (x);	  	  access_decls = scratch_tree_cons (NULL_TREE, x, access_decls);	  continue;	}      last_x = x;      if (TREE_CODE (x) == TYPE_DECL	  || TREE_CODE (x) == TEMPLATE_DECL)	continue;      /* If we've gotten this far, it's a data member, possibly static,	 or an enumerator.  */      DECL_FIELD_CONTEXT (x) = t;      /* ``A local class cannot have static data members.'' ARM 9.4 */      if (current_function_decl && TREE_STATIC (x))	cp_error_at ("field `%D' in local class cannot be static", x);      /* Perform error checking that did not get done in	 grokdeclarator.  */      if (TREE_CODE (TREE_TYPE (x)) == FUNCTION_TYPE)	{	  cp_error_at ("field `%D' invalidly declared function type",		       x);	  TREE_TYPE (x) = build_pointer_type (TREE_TYPE (x));	}      else if (TREE_CODE (TREE_TYPE (x)) == METHOD_TYPE)	{	  cp_error_at ("field `%D' invalidly declared method type", x);	  TREE_TYPE (x) = build_pointer_type (TREE_TYPE (x));	}      else if (TREE_CODE (TREE_TYPE (x)) == OFFSET_TYPE)	{	  cp_error_at ("field `%D' invalidly declared offset type", x);	  TREE_TYPE (x) = build_pointer_type (TREE_TYPE (x));	}#if 0      if (DECL_NAME (x) == constructor_name (t))	cant_have_default_ctor = 1;#endif      if (TREE_TYPE (x) == error_mark_node)	continue;	        DECL_SAVED_INSNS (x) = NULL_RTX;      DECL_FIELD_SIZE (x) = 0;      /* When this goes into scope, it will be a non-local reference.  */      DECL_NONLOCAL (x) = 1;      if (TREE_CODE (x) == CONST_DECL)	continue;      if (TREE_CODE (x) == VAR_DECL)	{	  if (TREE_CODE (t) == UNION_TYPE)	    /* Unions cannot have static members.  */	    cp_error_at ("field `%D' declared static in union", x);	      	  continue;	}      /* Now it can only be a FIELD_DECL.  */      if (TREE_PRIVATE (x) || TREE_PROTECTED (x))	aggregate = 0;      /* If this is of reference type, check if it needs an init.	 Also do a little ANSI jig if necessary.  */      if (TREE_CODE (TREE_TYPE (x)) == REFERENCE_TYPE) 	{	  if (DECL_INITIAL (x) == NULL_TREE)	    ref_sans_init = 1;	  /* ARM $12.6.2: [A member initializer list] (or, for an	     aggregate, initialization by a brace-enclosed list) is the	     only way to initialize nonstatic const and reference	     members.  */	  cant_have_default_ctor = 1;	  TYPE_HAS_COMPLEX_ASSIGN_REF (t) = 1;	  if (! TYPE_HAS_CONSTRUCTOR (t) && extra_warnings)	    {	      if (DECL_NAME (x))		cp_warning_at ("non-static reference `%#D' in class without a constructor", x);	      else		cp_warning_at ("non-static reference in class without a constructor", x);	    }	}      if (TREE_CODE (TREE_TYPE (x)) == POINTER_TYPE)	has_pointers = 1;      if (DECL_MUTABLE_P (x) || TYPE_HAS_MUTABLE_P (TREE_TYPE (x)))        has_mutable = 1;      /* If any field is const, the structure type is pseudo-const.  */      if (CP_TYPE_CONST_P (TREE_TYPE (x)))	{	  C_TYPE_FIELDS_READONLY (t) = 1;	  if (DECL_INITIAL (x) == NULL_TREE)	    const_sans_init = 1;	  /* ARM $12.6.2: [A member initializer list] (or, for an	     aggregate, initialization by a brace-enclosed list) is the	     only way to initialize nonstatic const and reference	     members.  */	  cant_have_default_ctor = 1;	  TYPE_HAS_COMPLEX_ASSIGN_REF (t) = 1;	  if (! TYPE_HAS_CONSTRUCTOR (t) && !IS_SIGNATURE (t)	      && extra_warnings)	    {	      if (DECL_NAME (x))		cp_warning_at ("non-static const member `%#D' in class without a constructor", x);	      else		cp_warning_at ("non-static const member in class without a constructor", x);	    }	}      else	{	  /* A field that is pseudo-const makes the structure	     likewise.  */	  tree t1 = TREE_TYPE (x);	  while (TREE_CODE (t1) == ARRAY_TYPE)	    t1 = TREE_TYPE (t1);	  if (IS_AGGR_TYPE (t1))	    {	      if (C_TYPE_FIELDS_READONLY (t1))		C_TYPE_FIELDS_READONLY (t) = 1;	      if (CLASSTYPE_READONLY_FIELDS_NEED_INIT (t1))		const_sans_init = 1;	    }	}      /* We set DECL_C_BIT_FIELD in grokbitfield.	 If the type and width are valid, we'll also set DECL_BIT_FIELD.  */      if (DECL_C_BIT_FIELD (x))	{	  /* Invalid bit-field size done by grokfield.  */	  /* Detect invalid bit-field type.  */	  if (DECL_INITIAL (x)	      && ! INTEGRAL_TYPE_P (TREE_TYPE (x)))	    {	      cp_error_at ("bit-field `%#D' with non-integral type", x);	      DECL_INITIAL (x) = NULL;	    }	  /* Detect and ignore out of range field width.  */	  if (DECL_INITIAL (x))	    {	      tree w = DECL_INITIAL (x);	      register int width = 0;	      /* Avoid the non_lvalue wrapper added by fold for PLUS_EXPRs.  */	      STRIP_NOPS (w);	      /* detect invalid field size.  */	      if (TREE_CODE (w) == CONST_DECL)		w = DECL_INITIAL (w);	      else if (TREE_READONLY_DECL_P (w))		w = decl_constant_value (w);	      if (TREE_CODE (w) != INTEGER_CST)		{		  cp_error_at ("bit-field `%D' width not an integer constant",			       x);		  DECL_INITIAL (x) = NULL_TREE;		}	      else if (width = TREE_INT_CST_LOW (w),		       width < 0)		{		  DECL_INITIAL (x) = NULL;		  cp_error_at ("negative width in bit-field `%D'", x);		}	      else if (width == 0 && DECL_NAME (x) != 0)		{		  DECL_INITIAL (x) = NULL;		  cp_error_at ("zero width for bit-field `%D'", x);		}	      else if (width		       > TYPE_PRECISION (long_long_unsigned_type_node))		{		  /* The backend will dump if you try to use something		     too big; avoid that.  */		  DECL_INITIAL (x) = NULL;		  sorry ("bit-fields larger than %d bits",			 TYPE_PRECISION (long_long_unsigned_type_node));		  cp_error_at ("  in declaration of `%D'", x);		}	      else if (width > TYPE_PRECISION (TREE_TYPE (x))		       && TREE_CODE (TREE_TYPE (x)) != ENUMERAL_TYPE		       && TREE_CODE (TREE_TYPE (x)) != BOOLEAN_TYPE)		{		  cp_warning_at ("width of `%D' exceeds its type", x);		}	      else if (TREE_CODE (TREE_TYPE (x)) == ENUMERAL_TYPE		       && ((min_precision (TYPE_MIN_VALUE (TREE_TYPE (x)),					   TREE_UNSIGNED (TREE_TYPE (x))) > width)			   || (min_precision (TYPE_MAX_VALUE (TREE_TYPE (x)),					      TREE_UNSIGNED (TREE_TYPE (x))) > width)))		{		  cp_warning_at ("`%D' is too small to hold all values of `%#T'",				 x, TREE_TYPE (x));		}	      if (DECL_INITIAL (x))		{		  DECL_INITIAL (x) = NULL_TREE;		  DECL_FIELD_SIZE (x) = width;		  DECL_BIT_FIELD (x) = 1;		  if (width == 0)		    {#ifdef EMPTY_FIELD_BOUNDARY		      DECL_ALIGN (x) = MAX (DECL_ALIGN (x),					    EMPTY_FIELD_BOUNDARY);#endif#ifdef PCC_BITFIELD_TYPE_MATTERS		      if (PCC_BITFIELD_TYPE_MATTERS)			DECL_ALIGN (x) = MAX (DECL_ALIGN (x),					      TYPE_ALIGN (TREE_TYPE (x)));#endif		    }		}	    }	  else	    /* Non-bit-fields are aligned for their type.  */	    DECL_ALIGN (x) = MAX (DECL_ALIGN (x), TYPE_ALIGN (TREE_TYPE (x)));	}      else	{	  tree type = TREE_TYPE (x);	  while (TREE_CODE (type) == ARRAY_TYPE)	    type = TREE_TYPE (type);	  if (TYPE_LANG_SPECIFIC (type) && ! ANON_UNION_P (x)	      && ! TYPE_PTRMEMFUNC_P (type))	    {	      /* Never let anything with uninheritable virtuals		 make it through without complaint.  */	      if (CLASSTYPE_ABSTRACT_VIRTUALS (type))		abstract_virtuals_error (x, type);		      	      /* Don't let signatures make it through either.  */	      if (IS_SIGNATURE (type))		signature_error (x, type);		      	      if (code == UNION_TYPE)		{		  const char *fie = NULL;		  if (TYPE_NEEDS_CONSTRUCTING (type))		    fie = "constructor";		  else if (TYPE_NEEDS_DESTRUCTOR (type))		    fie = "destructor";		  else if (TYPE_HAS_COMPLEX_ASSIGN_REF (type))		    fie = "copy assignment operator";		  if (fie)		    cp_error_at ("member `%#D' with %s not allowed in union", x,				 fie);		}	      else		{		  TYPE_NEEDS_CONSTRUCTING (t) |= TYPE_NEEDS_CONSTRUCTING (type);		  TYPE_NEEDS_DESTRUCTOR (t) |= TYPE_NEEDS_DESTRUCTOR (type);		  TYPE_HAS_COMPLEX_ASSIGN_REF (t) |= TYPE_HAS_COMPLEX_ASSIGN_REF (type);		  TYPE_HAS_COMPLEX_INIT_REF (t) |= TYPE_HAS_COMPLEX_INIT_REF (type);		}	      if (!TYPE_HAS_CONST_INIT_REF (type))		cant_have_const_ctor = 1;	      if (!TYPE_HAS_CONST_ASSIGN_REF (type))		no_const_asn_ref = 1;	      if (TYPE_HAS_CONSTRUCTOR (type)		  && ! TYPE_HAS_DEFAULT_CONSTRUCTOR (type))		{		  cant_have_default_ctor = 1;#if 0		  /* This is wrong for aggregates.  */		  if (! TYPE_HAS_CONSTRUCTOR (t))		    {		      if (DECL_NAME (x))			cp_pedwarn_at ("member `%#D' with only non-default constructor", x);		      else			cp_pedwarn_at ("member with only non-default constructor", x);		      cp_pedwarn_at ("in class without a constructor",				     x);		    }#endif		}	    }	  if (DECL_INITIAL (x) != NULL_TREE)	    {	      /* `build_class_init_list' does not recognize		 non-FIELD_DECLs.  */	      if (code == UNION_TYPE && any_default_members != 0)		cp_error_at ("multiple fields in union `%T' initialized");	      any_default_members = 1;	    }	}    }  /* If this type has any constant members which did not come     with their own initialization, mark that fact here.  It is     not an error here, since such types can be saved either by their     constructors, or by fortuitous initialization.  */  CLASSTYPE_READONLY_FIELDS_NEED_INIT (t) = const_sans_init;  CLASSTYPE_REF_FIELDS_NEED_INIT (t) = ref_sans_init;  CLASSTYPE_ABSTRACT_VIRTUALS (t) = abstract_virtuals;  CLASSTYPE_HAS_MUTABLE (t) = has_mutable;  /* Effective C++ rule 11.  */  if (has_pointers && warn_ecpp && TYPE_HAS_CONSTRUCTOR (t)      && ! (TYPE_HAS_INIT_REF (t) && TYPE_HAS_ASSIGN_REF (t)))    {      cp_warning ("`%#T' has pointer data members", t);            if (! TYPE_HAS_INIT_REF (t))	{	  cp_warning ("  but does not override `%T(const %T&)'", t, t);	  if (! TYPE_HAS_ASSIGN_REF (t))	    cp_warning ("  or `operator=(const %T&)'", t);	}      else if (! TYPE_HAS_ASSIGN_REF (t))	cp_warning ("  but does not override `operator=(const %T&)'", t);    }    /* Do some bookkeeping that will guide the generation of implicitly     declared member functions.  */  TYPE_HAS_COMPLEX_INIT_REF (t)    |= (TYPE_HAS_INIT_REF (t) || TYPE_USES_VIRTUAL_BASECLASSES (t)	|| has_virtual || any_default_members);  TYPE_NEEDS_CONSTRUCTING (t)    |= (TYPE_HAS_CONSTRUCTOR (t) || TYPE_USES_VIRTUAL_BASECLASSES (t)	|| has_virtual || any_default_members);  if (! IS_SIGNATURE (t))    CLASSTYPE_NON_AGGREGATE (t)      = ! aggregate || has_virtual || TYPE_HAS_CONSTRUCTOR (t);  TYPE_HAS_REAL_ASSIGN_REF (t) |= TYPE_HAS_ASSIGN_REF (t);  TYPE_HAS_COMPLEX_ASSIGN_REF (t)    |= TYPE_HAS_ASSIGN_REF (t) || TYPE_USES_VIRTUAL_BASECLASSES (t);  /* Synthesize any needed methods.  Note that methods will be synthesized     for anonymous unions; grok_x_components undoes that.  */  virtual_dtor     = add_implicitly_declared_members (t, cant_have_default_ctor,				       cant_have_const_ctor,				       no_const_asn_ref);  if (virtual_dtor)    add_virtual_function (&pending_virtuals, &pending_hard_virtuals,			  &has_virtual, virtual_dtor, t);  if (TYPE_METHODS (t))    {      finish_struct_methods (t);      method_vec = CLASSTYPE_METHOD_VEC (t);    }  else    {      method_vec = 0;      /* Just in case these got accidentally	 filled in by syntax errors.  */      TYPE_HAS_CONSTRUCTOR (t) = 0;      TYPE_HAS_DESTRUCTOR (t) = 0;    }  for (access_decls = nreverse (access_decls); access_decls;       access_decls = TREE_CHAIN (access_decls))    handle_using_decl (TREE_VALUE (access_decls), t, method_vec, fields);   if (vfield == NULL_TREE && has_virtual)    {      /* We build this decl with vtbl_ptr_type_node, which is a	 `vtable_entry_type*'.  It might seem more precise to use	 `vtable_entry_type (*)[N]' where N is the number of firtual	 functions.  However, that would require the vtable pointer in	 base classes to have a different type than the vtable pointer	 in derived classes.  We could make that happen, but that	 still wouldn't solve all the problems.  In particular, the	 type-based alias analysis code would decide that assignments	 to the base class vtable pointer can't alias assignments to	 the derived class vtable pointer, since they have different	 types.  Thus, in an derived class destructor, where the base	 class constructor was inlined, we could generate bad code for	 setting up the vtable pointer.           Therefore, we use one type for all vtable pointers.  We still	 use a type-correct type; it's just doesn't indicate the array	 bounds.  That's better than using `void*' or some such; it's	 cleaner, and it let's the alias analysis code know that these	 stores cannot alias stores to void*!  */      vfield = build_lang_field_decl (FIELD_DECL, get_vfield_name (t),				      vtbl_ptr_type_node);      /* If you change any of the below, take a look at all the	 other VFIELD_BASEs and VTABLE_BASEs in the code, and change	 them too.  */      DECL_ASSEMBLER_NAME (vfield) = get_identifier (VFIELD_BASE);      CLASSTYPE_VFIELD (t) = vfield;      DECL_VIRTUAL_P (vfield) = 1;      DECL_ARTIFICIAL (vfield) = 1;      DECL_FIELD_CONTEXT (vfield) = t;      DECL_CLASS_CONTEXT (vfield) = t;      DECL_FCONTEXT (vfield) = t;      DECL_SAVED_INSNS (vfield) = NULL_RTX;      DECL_FIELD_SIZE (vfield) = 0;      DECL_ALIGN (vfield) = TYPE_ALIGN (ptr_type_node);#if 0      /* This is more efficient, but breaks binary compatibility, turn	 it on sometime when we don't care.  If we turn it on, we also	 have to enable the code in dfs_init_vbase_pointers.  */      /* vfield is always first entry in structure.  */      TREE_CHAIN (vfield) = fields;      fields = vfield;#else      if (last_x)	{	  my_friendly_assert (TREE_CHAIN (last_x) == NULL_TREE, 175);	  TREE_CHAIN (last_x) = vfield;	  last_x = vfield;	}      else	fields = vfield;#endif      empty = 0;      vfields = chainon (vfields, build_tree_list (NULL_TREE, t));    }  /* Now DECL_INITIAL is null on all members except for zero-width bit-fields.     C++: maybe we will support default field initialization some day...  */  /* Delete all duplicate fields from the fields */  delete_duplicate_fields (fields);  /* Now we have the nearly final fieldlist for the data fields.  Record it,     then lay out the structure or union (including the fields).  */  TYPE_FIELDS (t) = fields;  if (n_baseclasses)    {      last_x = build_base_fields (t);      /* If all our bases are empty, we can be empty too.  */      for (x = last_x; empty && x; x = TREE_CHAIN (x))	if (DECL_SIZE (x) != integer_zero_node)	  empty = 0;    }  if (empty)    {      /* C++: do not let empty structures exist.  */      tree decl = build_lang_field_decl	(FIELD_DECL, NULL_TREE, char_type_node);      TREE_CHAIN (decl) = fields;      TYPE_FIELDS (t) = decl;    }  if (n_baseclasses)    TYPE_FIELDS (t) = chainon (last_x, TYPE_FIELDS (t));  layout_type (t);  /* Remember the size and alignment of the class before adding     the virtual bases.  */  if (empty && flag_new_abi)    CLASSTYPE_SIZE (t) = integer_zero_node;  else if (flag_new_abi && TYPE_HAS_COMPLEX_INIT_REF (t)	   && TYPE_HAS_COMPLEX_ASSIGN_REF (t))    CLASSTYPE_SIZE (t) = TYPE_BINFO_SIZE (t);  else    CLASSTYPE_SIZE (t) = TYPE_SIZE (t);  CLASSTYPE_ALIGN (t) = TYPE_ALIGN (t);  finish_struct_anon (t);  /* Set the TYPE_DECL for this type to contain the right     value for DECL_OFFSET, so that we can use it as part     of a COMPONENT_REF for multiple inheritance.  */  layout_decl (TYPE_MAIN_DECL (t), 0);  /* Now fix up any virtual base class types that we left lying     around.  We must get these done before we try to lay out the     virtual function table.  */  pending_hard_virtuals = nreverse (pending_hard_virtuals);  if (n_baseclasses)    /* layout_basetypes will remove the base subobject fields.  */    max_has_virtual = layout_basetypes (t, max_has_virtual);  if (empty)    TYPE_FIELDS (t) = fields;  my_friendly_assert (TYPE_FIELDS (t) == fields, 981117);  /* Delete all zero-width bit-fields from the front of the fieldlist */  while (fields && DECL_C_BIT_FIELD (fields)	 && DECL_INITIAL (fields))    fields = TREE_CHAIN (fields);  /* Delete all such fields from the rest of the fields.  */  for (x = fields; x;)    {      if (TREE_CHAIN (x) && DECL_C_BIT_FIELD (TREE_CHAIN (x))	  && DECL_INITIAL (TREE_CHAIN (x)))	TREE_CHAIN (x) = TREE_CHAIN (TREE_CHAIN (x));      else	x = TREE_CHAIN (x);    }  TYPE_FIELDS (t) = fields;  if (TYPE_USES_VIRTUAL_BASECLASSES (t))    {      tree vbases;      vbases = CLASSTYPE_VBASECLASSES (t);      {	/* Now fixup overrides of all functions in vtables from all	   direct or indirect virtual base classes.  */	tree binfos = BINFO_BASETYPES (TYPE_BINFO (t));	int i, n_baseclasses = binfos ? TREE_VEC_LENGTH (binfos) : 0;	for (i = 0; i < n_baseclasses; i++)	  {	    tree base_binfo = TREE_VEC_ELT (binfos, i);	    tree basetype = BINFO_TYPE (base_binfo);	    tree vbases;	    vbases = CLASSTYPE_VBASECLASSES (basetype);	    while (vbases)	      {		merge_overrides (binfo_member (BINFO_TYPE (vbases),					       CLASSTYPE_VBASECLASSES (t)),				 vbases, 1, t);		vbases = TREE_CHAIN (vbases);	      }	  }	}    }  /* Set up the DECL_FIELD_BITPOS of the vfield if we need to, as we     might need to know it for setting up the offsets in the vtable     (or in thunks) below.  */  if (vfield != NULL_TREE      && DECL_FIELD_CONTEXT (vfield) != t)    {      tree binfo = get_binfo (DECL_FIELD_CONTEXT (vfield), t, 0);      tree offset = BINFO_OFFSET (binfo);      vfield = copy_node (vfield);      copy_lang_decl (vfield);      if (! integer_zerop (offset))	offset = size_binop (MULT_EXPR, offset, size_int (BITS_PER_UNIT));      DECL_FIELD_CONTEXT (vfield) = t;      DECL_CLASS_CONTEXT (vfield) = t;      DECL_FIELD_BITPOS (vfield)	= size_binop (PLUS_EXPR, offset, DECL_FIELD_BITPOS (vfield));      CLASSTYPE_VFIELD (t) = vfield;    }    #ifdef NOTQUITE  cp_warning ("Doing hard virtuals for %T...", t);#endif  if (has_virtual > max_has_virtual)    max_has_virtual = has_virtual;  if (max_has_virtual > 0)    TYPE_VIRTUAL_P (t) = 1;  if (flag_rtti && TYPE_VIRTUAL_P (t) && !pending_hard_virtuals)    modify_all_vtables (t, NULL_TREE, NULL_TREE);  while (pending_hard_virtuals)    {      modify_all_vtables (t,			  TREE_PURPOSE (pending_hard_virtuals),			  TREE_VALUE (pending_hard_virtuals));      pending_hard_virtuals = TREE_CHAIN (pending_hard_virtuals);    }    if (TYPE_USES_VIRTUAL_BASECLASSES (t))    {      tree vbases;      /* Now fixup any virtual function entries from virtual bases	 that have different deltas.  This has to come after we do the	 pending hard virtuals, as we might have a function that comes	 from multiple virtual base instances that is only overridden	 by a hard virtual above.  */      vbases = CLASSTYPE_VBASECLASSES (t);      while (vbases)	{	  /* We might be able to shorten the amount of work we do by	     only doing this for vtables that come from virtual bases	     that have differing offsets, but don't want to miss any	     entries.  */	  fixup_vtable_deltas (vbases, 1, t);	  vbases = TREE_CHAIN (vbases);	}    }  /* Under our model of GC, every C++ class gets its own virtual     function table, at least virtually.  */  if (pending_virtuals)    {      pending_virtuals = nreverse (pending_virtuals);      /* We must enter these virtuals into the table.  */      if (first_vfn_base_index < 0)	{	  if (! CLASSTYPE_COM_INTERFACE (t))	    {	      /* The second slot is for the tdesc pointer when thunks are used.  */	      if (flag_vtable_thunks)		pending_virtuals = tree_cons (NULL_TREE, NULL_TREE, pending_virtuals);	      /* The first slot is for the rtti offset.  */	      pending_virtuals = tree_cons (NULL_TREE, NULL_TREE, pending_virtuals);	      set_rtti_entry (pending_virtuals,			      convert (ssizetype, integer_zero_node), t);	    }	  build_vtable (NULL_TREE, t);	}      else	{	  /* Here we know enough to change the type of our virtual	     function table, but we will wait until later this function.  */	  if (! BINFO_NEW_VTABLE_MARKED (TYPE_BINFO (t)))	    build_vtable (TREE_VEC_ELT (TYPE_BINFO_BASETYPES (t), first_vfn_base_index), t);	}      /* If this type has basetypes with constructors, then those	 constructors might clobber the virtual function table.  But	 they don't if the derived class shares the exact vtable of the base	 class.  */      CLASSTYPE_NEEDS_VIRTUAL_REINIT (t) = 1;    }  else if (first_vfn_base_index >= 0)    {      tree binfo = TREE_VEC_ELT (TYPE_BINFO_BASETYPES (t), first_vfn_base_index);      /* This class contributes nothing new to the virtual function	 table.  However, it may have declared functions which	 went into the virtual function table "inherited" from the	 base class.  If so, we grab a copy of those updated functions,	 and pretend they are ours.  */      /* See if we should steal the virtual info from base class.  */      if (TYPE_BINFO_VTABLE (t) == NULL_TREE)	TYPE_BINFO_VTABLE (t) = BINFO_VTABLE (binfo);      if (TYPE_BINFO_VIRTUALS (t) == NULL_TREE)	TYPE_BINFO_VIRTUALS (t) = BINFO_VIRTUALS (binfo);      if (TYPE_BINFO_VTABLE (t) != BINFO_VTABLE (binfo))	CLASSTYPE_NEEDS_VIRTUAL_REINIT (t) = 1;    }  if (max_has_virtual || first_vfn_base_index >= 0)    {      CLASSTYPE_VSIZE (t) = has_virtual;      if (first_vfn_base_index >= 0)	{	  if (pending_virtuals)	    TYPE_BINFO_VIRTUALS (t) = chainon (TYPE_BINFO_VIRTUALS (t),						pending_virtuals);	}      else if (has_virtual)	{	  TYPE_BINFO_VIRTUALS (t) = pending_virtuals;	  DECL_VIRTUAL_P (TYPE_BINFO_VTABLE (t)) = 1;	}    }  /* Now lay out the virtual function table.  */  if (has_virtual)    {      /* Use size_int so values are memoized in common cases.  */      tree itype = build_index_type (size_int (has_virtual));      tree atype = build_cplus_array_type (vtable_entry_type, itype);      layout_type (atype);      CLASSTYPE_VFIELD (t) = vfield;      /* We may have to grow the vtable.  */      if (TREE_TYPE (TYPE_BINFO_VTABLE (t)) != atype)	{	  TREE_TYPE (TYPE_BINFO_VTABLE (t)) = atype;	  DECL_SIZE (TYPE_BINFO_VTABLE (t)) = 0;	  layout_decl (TYPE_BINFO_VTABLE (t), 0);	  /* At one time the vtable info was grabbed 2 words at a time.  This	     fails on sparc unless you have 8-byte alignment.  (tiemann) */	  DECL_ALIGN (TYPE_BINFO_VTABLE (t))	    = MAX (TYPE_ALIGN (double_type_node),		   DECL_ALIGN (TYPE_BINFO_VTABLE (t)));	}    }  else if (first_vfn_base_index >= 0)    CLASSTYPE_VFIELD (t) = vfield;  CLASSTYPE_VFIELDS (t) = vfields;  finish_struct_bits (t, max_has_virtual);  /* Complete the rtl for any static member objects of the type we're     working on.  */  for (x = fields; x; x = TREE_CHAIN (x))    {      if (TREE_CODE (x) == VAR_DECL && TREE_STATIC (x)	  && TREE_TYPE (x) == t)	{	  DECL_MODE (x) = TYPE_MODE (t);	  make_decl_rtl (x, NULL, 0);	}    }  if (TYPE_HAS_CONSTRUCTOR (t))    {      tree vfields = CLASSTYPE_VFIELDS (t);      while (vfields)	{	  /* Mark the fact that constructor for T	     could affect anybody inheriting from T	     who wants to initialize vtables for VFIELDS's type.  */	  if (VF_DERIVED_VALUE (vfields))	    TREE_ADDRESSABLE (vfields) = 1;	  vfields = TREE_CHAIN (vfields);	}    }  /* Write out inline function definitions.  */  do_inline_function_hair (t, CLASSTYPE_INLINE_FRIENDS (t));  CLASSTYPE_INLINE_FRIENDS (t) = 0;  if (CLASSTYPE_VSIZE (t) != 0)    {#if 0      /* This is now done above.  */      if (DECL_FIELD_CONTEXT (vfield) != t)	{	  tree binfo = get_binfo (DECL_FIELD_CONTEXT (vfield), t, 0);	  tree offset = BINFO_OFFSET (binfo);	  vfield = copy_node (vfield);	  copy_lang_decl (vfield);	  if (! integer_zerop (offset))	    offset = size_binop (MULT_EXPR, offset, size_int (BITS_PER_UNIT));	  DECL_FIELD_CONTEXT (vfield) = t;	  DECL_CLASS_CONTEXT (vfield) = t;	  DECL_FIELD_BITPOS (vfield)	    = size_binop (PLUS_EXPR, offset, DECL_FIELD_BITPOS (vfield));	  CLASSTYPE_VFIELD (t) = vfield;	}#endif      /* In addition to this one, all the other vfields should be listed.  */      /* Before that can be done, we have to have FIELD_DECLs for them, and	 a place to find them.  */      TYPE_NONCOPIED_PARTS (t) = build_tree_list (default_conversion (TYPE_BINFO_VTABLE (t)), vfield);      if (warn_nonvdtor && TYPE_HAS_DESTRUCTOR (t)	  && DECL_VINDEX (TREE_VEC_ELT (method_vec, 1)) == NULL_TREE)	cp_warning ("`%#T' has virtual functions but non-virtual destructor",		    t);    }  /* Make the rtl for any new vtables we have created, and unmark     the base types we marked.  */  finish_vtbls (TYPE_BINFO (t), 1, t);  hack_incomplete_structures (t);#if 0  if (TYPE_NAME (t) && TYPE_IDENTIFIER (t))    undo_template_name_overload (TYPE_IDENTIFIER (t), 1);#endif  resume_momentary (old);  if (warn_overloaded_virtual)    warn_hidden (t);#if 0  /* This has to be done after we have sorted out what to do with     the enclosing type.  */  if (write_symbols != DWARF_DEBUG)    {      /* Be smarter about nested classes here.  If a type is nested,	 only output it if we would output the enclosing type.  */      if (DECL_CLASS_SCOPE_P (TYPE_MAIN_DECL (t)))	DECL_IGNORED_P (TYPE_MAIN_DECL (t)) = TREE_ASM_WRITTEN (TYPE_MAIN_DECL (t));    }#endif  if (write_symbols != DWARF_DEBUG && write_symbols != DWARF2_DEBUG)    {      /* If the type has methods, we want to think about cutting down	 the amount of symbol table stuff we output.  The value stored in	 the TYPE_DECL's DECL_IGNORED_P slot is a first approximation.	 For example, if a member function is seen and we decide to	 write out that member function, then we can change the value	 of the DECL_IGNORED_P slot, and the type will be output when	 that member function's debug info is written out.	 We can't do this with DWARF, which does not support name	 references between translation units.  */      if (CLASSTYPE_METHOD_VEC (t))	{	  /* Don't output full info about any type	     which does not have its implementation defined here.  */	  if (CLASSTYPE_INTERFACE_ONLY (t))	    TYPE_DECL_SUPPRESS_DEBUG (TYPE_MAIN_DECL (t)) = 1;#if 0	  /* XXX do something about this.  */	  else if (CLASSTYPE_INTERFACE_UNKNOWN (t))	    /* Only a first approximation!  */	    TYPE_DECL_SUPPRESS_DEBUG (TYPE_MAIN_DECL (t)) = 1;#endif	}      else if (CLASSTYPE_INTERFACE_ONLY (t))	TYPE_DECL_SUPPRESS_DEBUG (TYPE_MAIN_DECL (t)) = 1;    }  /* Finish debugging output for this type.  */  rest_of_type_compilation (t, toplevel_bindings_p ());  return;}