+2000-04-11 Mark Mitchell <mark@codesourcery.com>
+
+ * cp-tree.h (lang_type): Remove has_nonpublic_ctor and
+ has_nonpublic_assign_ref.
+ (TYPE_HAS_NONPUBLIC_CTOR): Don't declare.
+ (TYPE_HAS_NONPUBLIC_ASSIGN_REF): Likewise.
+ * class.c (finish_struct_methods): Don't set
+ TYPE_HAS_NONPUBLIC_CTOR or TYPE_HAS_NONPUBLIC_ASSIGN_REF.
+ (interface_only): Don't declare.
+ (interface_unknown): Likewise.
+
2000-04-11 Martin v. Löwis <loewis@informatik.hu-berlin.de>
* tree.h (HAVE_TEMPLATES): Remove definition.
list. That allows them to be quickly deleted, and requires no
extra storage.
- If there are any constructors/destructors, they are moved to the
- front of the list. This makes pushclass more efficient.
-
- @@ The above comment is obsolete. It mostly describes what add_method
- @@ and add_implicitly_declared_members do.
-
- Sort methods that are not special (i.e., constructors, destructors, and
- type conversion operators) so that we can find them faster in search. */
+ Sort methods that are not special (i.e., constructors, destructors,
+ and type conversion operators) so that we can find them faster in
+ search. */
static void
finish_struct_methods (t)
{
tree fn_fields;
tree method_vec;
- tree ctor_name = constructor_name (t);
int slot, len;
if (!TYPE_METHODS (t))
and the next few with type conversion operators (if any). */
for (fn_fields = TYPE_METHODS (t); fn_fields;
fn_fields = TREE_CHAIN (fn_fields))
- {
- tree fn_name = DECL_NAME (fn_fields);
-
- /* Clear out this flag.
-
- @@ Doug may figure out how to break
- @@ this with nested classes and friends. */
- DECL_IN_AGGR_P (fn_fields) = 0;
-
- /* Note here that a copy ctor is private, so we don't dare generate
- a default copy constructor for a class that has a member
- of this type without making sure they have access to it. */
- if (fn_name == ctor_name)
- {
- tree parmtypes = FUNCTION_ARG_CHAIN (fn_fields);
- tree parmtype = parmtypes ? TREE_VALUE (parmtypes) : void_type_node;
-
- if (TREE_CODE (parmtype) == REFERENCE_TYPE
- && TYPE_MAIN_VARIANT (TREE_TYPE (parmtype)) == t)
- {
- if (TREE_CHAIN (parmtypes) == NULL_TREE
- || TREE_CHAIN (parmtypes) == void_list_node
- || TREE_PURPOSE (TREE_CHAIN (parmtypes)))
- {
- if (TREE_PROTECTED (fn_fields))
- TYPE_HAS_NONPUBLIC_CTOR (t) = 1;
- else if (TREE_PRIVATE (fn_fields))
- TYPE_HAS_NONPUBLIC_CTOR (t) = 2;
- }
- }
- }
- else if (fn_name == ansi_opname[(int) MODIFY_EXPR])
- {
- tree parmtype = TREE_VALUE (FUNCTION_ARG_CHAIN (fn_fields));
-
- if (copy_assignment_arg_p (parmtype, DECL_VIRTUAL_P (fn_fields)))
- {
- if (TREE_PROTECTED (fn_fields))
- TYPE_HAS_NONPUBLIC_ASSIGN_REF (t) = 1;
- else if (TREE_PRIVATE (fn_fields))
- TYPE_HAS_NONPUBLIC_ASSIGN_REF (t) = 2;
- }
- }
- }
+ /* Clear out this flag. */
+ DECL_IN_AGGR_P (fn_fields) = 0;
if (TYPE_HAS_DESTRUCTOR (t) && !TREE_VEC_ELT (method_vec, 1))
/* We thought there was a destructor, but there wasn't. Some
}
}
-extern int interface_only, interface_unknown;
-
/* Create default constructors, assignment operators, and so forth for
the type indicated by T, if they are needed.
CANT_HAVE_DEFAULT_CTOR, CANT_HAVE_CONST_CTOR, and
unsigned has_const_assign_ref : 1;
unsigned anon_aggr : 1;
- unsigned has_nonpublic_ctor : 2;
- unsigned has_nonpublic_assign_ref : 2;
+ unsigned has_mutable : 1;
+ unsigned com_interface : 1;
+ unsigned non_pod_class : 1;
+ unsigned nearly_empty_p : 1;
unsigned vtable_needs_writing : 1;
unsigned has_assign_ref : 1;
unsigned has_new : 1;
unsigned has_abstract_assign_ref : 1;
unsigned non_aggregate : 1;
unsigned is_partial_instantiation : 1;
- unsigned has_mutable : 1;
-
- unsigned com_interface : 1;
- unsigned non_pod_class : 1;
- unsigned nearly_empty_p : 1;
/* When adding a flag here, consider whether or not it ought to
apply to a template instance if it applies to the template. If
so, make sure to copy it in instantiate_class_template! */
- /* There are six bits left to fill out a 32-bit word. Keep track of
- this by updating the size of this bitfield whenever you add or
+ /* There are some bits left to fill out a 32-bit word. Keep track
+ of this by updating the size of this bitfield whenever you add or
remove a flag. */
- unsigned dummy : 5;
+ unsigned dummy : 9;
int vsize;
int vfield_parent;
/* Nonzero means that this type has an X() constructor. */
#define TYPE_HAS_DEFAULT_CONSTRUCTOR(NODE) (TYPE_LANG_SPECIFIC(NODE)->has_default_ctor)
-/* Nonzero means the type declared a ctor as private or protected. We
- use this to make sure we don't try to generate a copy ctor for a
- class that has a member of type NODE. */
-#define TYPE_HAS_NONPUBLIC_CTOR(NODE) (TYPE_LANG_SPECIFIC(NODE)->has_nonpublic_ctor)
-
-/* Ditto, for operator=. */
-#define TYPE_HAS_NONPUBLIC_ASSIGN_REF(NODE) (TYPE_LANG_SPECIFIC(NODE)->has_nonpublic_assign_ref)
-
/* Nonzero means that this type contains a mutable member */
#define CLASSTYPE_HAS_MUTABLE(NODE) (TYPE_LANG_SPECIFIC(NODE)->has_mutable)
#define TYPE_HAS_MUTABLE_P(NODE) (cp_has_mutable_p (NODE))