diff options
author | Jason Merrill <jason@redhat.com> | 2010-06-29 20:50:34 -0400 |
---|---|---|
committer | Jason Merrill <jason@gcc.gnu.org> | 2010-06-29 20:50:34 -0400 |
commit | 066ec0a4a0c12148352889d7d26a2975960d5571 (patch) | |
tree | 1dc72ac1b9d7b731b6d2781f3b6a4919857d0c4c | |
parent | 99453ddd870da9e9466dfdf14ebccb1cd31d52e9 (diff) | |
download | gcc-066ec0a4a0c12148352889d7d26a2975960d5571.zip gcc-066ec0a4a0c12148352889d7d26a2975960d5571.tar.gz gcc-066ec0a4a0c12148352889d7d26a2975960d5571.tar.bz2 |
cp-tree.h (TYPE_HAS_ASSIGN_REF): Rename to TYPE_HAS_COPY_ASSIGN.
* cp-tree.h (TYPE_HAS_ASSIGN_REF): Rename to TYPE_HAS_COPY_ASSIGN.
(TYPE_HAS_CONST_ASSIGN_REF): Rename to TYPE_HAS_CONST_COPY_ASSIGN.
(TYPE_HAS_INIT_REF): Rename to TYPE_HAS_COPY_CTOR.
(TYPE_HAS_CONST_INIT_REF): Rename to TYPE_HAS_CONST_COPY_CTOR.
(TYPE_HAS_COMPLEX_ASSIGN_REF): Rename to TYPE_HAS_COMPLEX_COPY_ASSIGN.
(TYPE_HAS_COMPLEX_INIT_REF): Rename to TYPE_HAS_COMPLEX_COPY_CTOR.
(TYPE_HAS_TRIVIAL_ASSIGN_REF): Rename to TYPE_HAS_TRIVIAL_COPY_ASSIGN.
(TYPE_HAS_TRIVIAL_INIT_REF): Rename to TYPE_HAS_TRIVIAL_COPY_CTOR.
(CLASSTYPE_LAZY_ASSIGNMENT_OP): Rename to CLASSTYPE_LAZY_COPY_ASSIGN.
(sfk_assignment_operator): Rename to sfk_copy_assignment.
* decl.c, call.c, class.c, init.c, method.c, pt.c, ptree.c: Adjust.
* search.c, semantics.c, tree.c: Adjust.
From-SVN: r161577
-rw-r--r-- | gcc/cp/ChangeLog | 13 | ||||
-rw-r--r-- | gcc/cp/call.c | 10 | ||||
-rw-r--r-- | gcc/cp/class.c | 74 | ||||
-rw-r--r-- | gcc/cp/cp-tree.h | 51 | ||||
-rw-r--r-- | gcc/cp/decl.c | 22 | ||||
-rw-r--r-- | gcc/cp/init.c | 2 | ||||
-rw-r--r-- | gcc/cp/method.c | 34 | ||||
-rw-r--r-- | gcc/cp/pt.c | 8 | ||||
-rw-r--r-- | gcc/cp/ptree.c | 6 | ||||
-rw-r--r-- | gcc/cp/search.c | 4 | ||||
-rw-r--r-- | gcc/cp/semantics.c | 10 | ||||
-rw-r--r-- | gcc/cp/tree.c | 10 | ||||
-rw-r--r-- | gcc/cp/typeck2.c | 2 |
13 files changed, 130 insertions, 116 deletions
diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index 0f88f2b..7eaca7f 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -1,5 +1,18 @@ 2010-06-29 Jason Merrill <jason@redhat.com> + * cp-tree.h (TYPE_HAS_ASSIGN_REF): Rename to TYPE_HAS_COPY_ASSIGN. + (TYPE_HAS_CONST_ASSIGN_REF): Rename to TYPE_HAS_CONST_COPY_ASSIGN. + (TYPE_HAS_INIT_REF): Rename to TYPE_HAS_COPY_CTOR. + (TYPE_HAS_CONST_INIT_REF): Rename to TYPE_HAS_CONST_COPY_CTOR. + (TYPE_HAS_COMPLEX_ASSIGN_REF): Rename to TYPE_HAS_COMPLEX_COPY_ASSIGN. + (TYPE_HAS_COMPLEX_INIT_REF): Rename to TYPE_HAS_COMPLEX_COPY_CTOR. + (TYPE_HAS_TRIVIAL_ASSIGN_REF): Rename to TYPE_HAS_TRIVIAL_COPY_ASSIGN. + (TYPE_HAS_TRIVIAL_INIT_REF): Rename to TYPE_HAS_TRIVIAL_COPY_CTOR. + (CLASSTYPE_LAZY_ASSIGNMENT_OP): Rename to CLASSTYPE_LAZY_COPY_ASSIGN. + (sfk_assignment_operator): Rename to sfk_copy_assignment. + * decl.c, call.c, class.c, init.c, method.c, pt.c, ptree.c: Adjust. + * search.c, semantics.c, tree.c: Adjust. + * pt.c (dependent_scope_ref_p): Remove. (value_dependent_expression_p): Don't call it. (type_dependent_expression_p): Here either. diff --git a/gcc/cp/call.c b/gcc/cp/call.c index faaab10..c05e5a1 100644 --- a/gcc/cp/call.c +++ b/gcc/cp/call.c @@ -5197,7 +5197,7 @@ convert_like_real (conversion *convs, tree expr, tree fn, int argnum, OK. */ if ((lvalue & clk_packed) && CLASS_TYPE_P (type) - && !TYPE_HAS_TRIVIAL_INIT_REF (type)) + && !TYPE_HAS_TRIVIAL_COPY_CTOR (type)) { if (complain & tf_error) error ("cannot bind packed field %qE to %qT", @@ -5853,7 +5853,7 @@ build_over_call (struct z_candidate *cand, int flags, tsubst_flags_t complain) } /* [class.copy]: the copy constructor is implicitly defined even if the implementation elided its use. */ - else if (TYPE_HAS_COMPLEX_INIT_REF (DECL_CONTEXT (fn)) + else if (TYPE_HAS_COMPLEX_COPY_CTOR (DECL_CONTEXT (fn)) || move_fn_p (fn)) { mark_used (fn); @@ -5872,12 +5872,12 @@ build_over_call (struct z_candidate *cand, int flags, tsubst_flags_t complain) { if (TREE_CODE (arg) == TARGET_EXPR) return arg; - else if (TYPE_HAS_TRIVIAL_INIT_REF (DECL_CONTEXT (fn)) + else if (TYPE_HAS_TRIVIAL_COPY_CTOR (DECL_CONTEXT (fn)) && !move_fn_p (fn)) return build_target_expr_with_type (arg, DECL_CONTEXT (fn)); } else if (TREE_CODE (arg) == TARGET_EXPR - || (TYPE_HAS_TRIVIAL_INIT_REF (DECL_CONTEXT (fn)) + || (TYPE_HAS_TRIVIAL_COPY_CTOR (DECL_CONTEXT (fn)) && !move_fn_p (fn))) { tree to = stabilize_reference (cp_build_indirect_ref (fa, RO_NULL, @@ -5889,7 +5889,7 @@ build_over_call (struct z_candidate *cand, int flags, tsubst_flags_t complain) } else if (DECL_OVERLOADED_OPERATOR_P (fn) == NOP_EXPR && copy_fn_p (fn) - && TYPE_HAS_TRIVIAL_ASSIGN_REF (DECL_CONTEXT (fn))) + && TYPE_HAS_TRIVIAL_COPY_ASSIGN (DECL_CONTEXT (fn))) { tree to = stabilize_reference (cp_build_indirect_ref (argarray[0], RO_NULL, complain)); diff --git a/gcc/cp/class.c b/gcc/cp/class.c index 51f749f..3a87555 100644 --- a/gcc/cp/class.c +++ b/gcc/cp/class.c @@ -1282,10 +1282,10 @@ check_bases (tree t, assignment operators that take const references, then the derived class cannot have such a member automatically generated. */ - if (! TYPE_HAS_CONST_INIT_REF (basetype)) + if (! TYPE_HAS_CONST_COPY_CTOR (basetype)) *cant_have_const_ctor_p = 1; - if (TYPE_HAS_ASSIGN_REF (basetype) - && !TYPE_HAS_CONST_ASSIGN_REF (basetype)) + if (TYPE_HAS_COPY_ASSIGN (basetype) + && !TYPE_HAS_CONST_COPY_ASSIGN (basetype)) *no_const_asn_ref_p = 1; if (BINFO_VIRTUAL_P (base_binfo)) @@ -1311,9 +1311,9 @@ check_bases (tree t, TYPE_NEEDS_CONSTRUCTING (t) |= TYPE_NEEDS_CONSTRUCTING (basetype); TYPE_HAS_NONTRIVIAL_DESTRUCTOR (t) |= TYPE_HAS_NONTRIVIAL_DESTRUCTOR (basetype); - TYPE_HAS_COMPLEX_ASSIGN_REF (t) - |= TYPE_HAS_COMPLEX_ASSIGN_REF (basetype); - TYPE_HAS_COMPLEX_INIT_REF (t) |= TYPE_HAS_COMPLEX_INIT_REF (basetype); + TYPE_HAS_COMPLEX_COPY_ASSIGN (t) + |= TYPE_HAS_COMPLEX_COPY_ASSIGN (basetype); + TYPE_HAS_COMPLEX_COPY_CTOR (t) |= TYPE_HAS_COMPLEX_COPY_CTOR (basetype); TYPE_POLYMORPHIC_P (t) |= TYPE_POLYMORPHIC_P (basetype); CLASSTYPE_CONTAINS_EMPTY_CLASS_P (t) |= CLASSTYPE_CONTAINS_EMPTY_CLASS_P (basetype); @@ -1541,7 +1541,7 @@ finish_struct_bits (tree t) mode to be BLKmode, and force its TREE_ADDRESSABLE bit to be nonzero. This will cause it to be passed by invisible reference and prevent it from being returned in a register. */ - if (! TYPE_HAS_TRIVIAL_INIT_REF (t) || TYPE_HAS_NONTRIVIAL_DESTRUCTOR (t)) + if (! TYPE_HAS_TRIVIAL_COPY_CTOR (t) || TYPE_HAS_NONTRIVIAL_DESTRUCTOR (t)) { tree variants; DECL_MODE (TYPE_MAIN_DECL (t)) = BLKmode; @@ -1668,10 +1668,10 @@ maybe_warn_about_overly_private_class (tree t) template <class T> class C { private: C(); }; - To avoid this asymmetry, we check TYPE_HAS_INIT_REF. All + To avoid this asymmetry, we check TYPE_HAS_COPY_CTOR. All complete non-template or fully instantiated classes have this flag set. */ - if (!TYPE_HAS_INIT_REF (t)) + if (!TYPE_HAS_COPY_CTOR (t)) nonprivate_ctor = 1; else for (fn = CLASSTYPE_CONSTRUCTORS (t); fn; fn = OVL_NEXT (fn)) @@ -2643,14 +2643,14 @@ add_implicitly_declared_members (tree t, If a class definition does not explicitly declare a copy constructor, one is declared implicitly. */ - if (! TYPE_HAS_INIT_REF (t) && ! TYPE_FOR_JAVA (t)) + if (! TYPE_HAS_COPY_CTOR (t) && ! TYPE_FOR_JAVA (t)) { - TYPE_HAS_INIT_REF (t) = 1; - TYPE_HAS_CONST_INIT_REF (t) = !cant_have_const_cctor; + TYPE_HAS_COPY_CTOR (t) = 1; + TYPE_HAS_CONST_COPY_CTOR (t) = !cant_have_const_cctor; CLASSTYPE_LAZY_COPY_CTOR (t) = 1; } - /* Currently only lambdas get a lazy move ctor, but N2987 adds them for + /* Currently only lambdas get a lazy move ctor, but N3053 adds them for other classes. */ if (LAMBDA_TYPE_P (t)) CLASSTYPE_LAZY_MOVE_CTOR (t) = 1; @@ -2659,17 +2659,17 @@ add_implicitly_declared_members (tree t, 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. */ - if (!TYPE_HAS_ASSIGN_REF (t) && !TYPE_FOR_JAVA (t)) + if (!TYPE_HAS_COPY_ASSIGN (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; + TYPE_HAS_COPY_ASSIGN (t) = 1; + TYPE_HAS_CONST_COPY_ASSIGN (t) = !cant_have_const_assignment; + CLASSTYPE_LAZY_COPY_ASSIGN (t) = 1; } /* We can't be lazy about declaring functions that might override a virtual function from a base class. */ if (TYPE_POLYMORPHIC_P (t) - && (CLASSTYPE_LAZY_ASSIGNMENT_OP (t) + && (CLASSTYPE_LAZY_COPY_ASSIGN (t) || CLASSTYPE_LAZY_DESTRUCTOR (t))) { tree binfo = TYPE_BINFO (t); @@ -2684,8 +2684,8 @@ add_implicitly_declared_members (tree t, tree fn = BV_FN (bv); if (DECL_NAME (fn) == opname) { - if (CLASSTYPE_LAZY_ASSIGNMENT_OP (t)) - lazily_declare_fn (sfk_assignment_operator, t); + if (CLASSTYPE_LAZY_COPY_ASSIGN (t)) + lazily_declare_fn (sfk_copy_assignment, t); } else if (DECL_DESTRUCTOR_P (fn) && CLASSTYPE_LAZY_DESTRUCTOR (t)) @@ -2819,7 +2819,7 @@ check_field_decl (tree field, the settings of CANT_HAVE_CONST_CTOR and friends. */ if (ANON_UNION_TYPE_P (type)) ; - /* And, we don't set TYPE_HAS_CONST_INIT_REF, etc., for anonymous + /* And, we don't set TYPE_HAS_CONST_COPY_CTOR, etc., for anonymous structs. So, we recurse through their fields here. */ else if (ANON_AGGR_TYPE_P (type)) { @@ -2845,7 +2845,7 @@ check_field_decl (tree field, field); if (TYPE_HAS_NONTRIVIAL_DESTRUCTOR (type)) error ("member %q+#D with destructor not allowed in union", field); - if (TYPE_HAS_COMPLEX_ASSIGN_REF (type)) + if (TYPE_HAS_COMPLEX_COPY_ASSIGN (type)) error ("member %q+#D with copy assignment operator not allowed in union", field); } @@ -2854,15 +2854,15 @@ check_field_decl (tree field, TYPE_NEEDS_CONSTRUCTING (t) |= TYPE_NEEDS_CONSTRUCTING (type); TYPE_HAS_NONTRIVIAL_DESTRUCTOR (t) |= TYPE_HAS_NONTRIVIAL_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); + TYPE_HAS_COMPLEX_COPY_ASSIGN (t) |= TYPE_HAS_COMPLEX_COPY_ASSIGN (type); + TYPE_HAS_COMPLEX_COPY_CTOR (t) |= TYPE_HAS_COMPLEX_COPY_CTOR (type); TYPE_HAS_COMPLEX_DFLT (t) |= TYPE_HAS_COMPLEX_DFLT (type); } - if (!TYPE_HAS_CONST_INIT_REF (type)) + if (!TYPE_HAS_CONST_COPY_CTOR (type)) *cant_have_const_ctor = 1; - if (!TYPE_HAS_CONST_ASSIGN_REF (type)) + if (!TYPE_HAS_CONST_COPY_ASSIGN (type)) *no_const_asn_ref = 1; } if (DECL_INITIAL (field) != NULL_TREE) @@ -3021,7 +3021,7 @@ check_field_decls (tree t, tree *access_decls, aggregate, initialization by a brace-enclosed list) is the only way to initialize nonstatic const and reference members. */ - TYPE_HAS_COMPLEX_ASSIGN_REF (t) = 1; + TYPE_HAS_COMPLEX_COPY_ASSIGN (t) = 1; } type = strip_array_types (type); @@ -3107,7 +3107,7 @@ check_field_decls (tree t, tree *access_decls, aggregate, initialization by a brace-enclosed list) is the only way to initialize nonstatic const and reference members. */ - TYPE_HAS_COMPLEX_ASSIGN_REF (t) = 1; + TYPE_HAS_COMPLEX_COPY_ASSIGN (t) = 1; } /* A field that is pseudo-const makes the structure likewise. */ else if (CLASS_TYPE_P (type)) @@ -3144,18 +3144,18 @@ check_field_decls (tree t, tree *access_decls, && has_pointers && TYPE_HAS_USER_CONSTRUCTOR (t) && TYPE_HAS_NONTRIVIAL_DESTRUCTOR (t) - && !(TYPE_HAS_INIT_REF (t) && TYPE_HAS_ASSIGN_REF (t))) + && !(TYPE_HAS_COPY_CTOR (t) && TYPE_HAS_COPY_ASSIGN (t))) { warning (OPT_Weffc__, "%q#T has pointer data members", t); - if (! TYPE_HAS_INIT_REF (t)) + if (! TYPE_HAS_COPY_CTOR (t)) { warning (OPT_Weffc__, " but does not override %<%T(const %T&)%>", t, t); - if (!TYPE_HAS_ASSIGN_REF (t)) + if (!TYPE_HAS_COPY_ASSIGN (t)) warning (OPT_Weffc__, " or %<operator=(const %T&)%>", t); } - else if (! TYPE_HAS_ASSIGN_REF (t)) + else if (! TYPE_HAS_COPY_ASSIGN (t)) warning (OPT_Weffc__, " but does not override %<operator=(const %T&)%>", t); } @@ -4375,7 +4375,7 @@ check_bases_and_members (tree t) /* Save the initial values of these flags which only indicate whether or not the class has user-provided functions. As we analyze the bases and members we can set these flags for other reasons. */ - saved_complex_asn_ref = TYPE_HAS_COMPLEX_ASSIGN_REF (t); + saved_complex_asn_ref = TYPE_HAS_COMPLEX_COPY_ASSIGN (t); saved_nontrivial_dtor = TYPE_HAS_NONTRIVIAL_DESTRUCTOR (t); /* Check all the data member declarations. We cannot call @@ -4393,7 +4393,7 @@ check_bases_and_members (tree t) /* Do some bookkeeping that will guide the generation of implicitly declared member functions. */ - TYPE_HAS_COMPLEX_INIT_REF (t) |= TYPE_CONTAINS_VPTR_P (t); + TYPE_HAS_COMPLEX_COPY_CTOR (t) |= TYPE_CONTAINS_VPTR_P (t); /* We need to call a constructor for this class if it has a user-provided constructor, or if the default constructor is going to initialize the vptr. (This is not an if-and-only-if; @@ -4416,7 +4416,7 @@ check_bases_and_members (tree t) |= (CLASSTYPE_NON_AGGREGATE (t) || saved_nontrivial_dtor || saved_complex_asn_ref); CLASSTYPE_NON_STD_LAYOUT (t) |= TYPE_CONTAINS_VPTR_P (t); - TYPE_HAS_COMPLEX_ASSIGN_REF (t) |= TYPE_CONTAINS_VPTR_P (t); + TYPE_HAS_COMPLEX_COPY_ASSIGN (t) |= TYPE_CONTAINS_VPTR_P (t); TYPE_HAS_COMPLEX_DFLT (t) |= TYPE_CONTAINS_VPTR_P (t); /* If the class has no user-declared constructor, but does have @@ -4488,8 +4488,8 @@ check_bases_and_members (tree t) TYPE_NEEDS_CONSTRUCTING (t) = 1; TYPE_HAS_DEFAULT_CONSTRUCTOR (t) = 0; CLASSTYPE_LAZY_DEFAULT_CTOR (t) = 0; - TYPE_HAS_ASSIGN_REF (t) = 0; - CLASSTYPE_LAZY_ASSIGNMENT_OP (t) = 0; + TYPE_HAS_COPY_ASSIGN (t) = 0; + CLASSTYPE_LAZY_COPY_ASSIGN (t) = 0; /* "This class type is not an aggregate." */ CLASSTYPE_NON_AGGREGATE (t) = 1; diff --git a/gcc/cp/cp-tree.h b/gcc/cp/cp-tree.h index 285dac7..1b3c2f0 100644 --- a/gcc/cp/cp-tree.h +++ b/gcc/cp/cp-tree.h @@ -1239,11 +1239,11 @@ struct GTY(()) lang_type_header { BOOL_BITFIELD is_lang_type_class : 1; BOOL_BITFIELD has_type_conversion : 1; - BOOL_BITFIELD has_init_ref : 1; + BOOL_BITFIELD has_copy_ctor : 1; BOOL_BITFIELD has_default_ctor : 1; BOOL_BITFIELD const_needs_init : 1; BOOL_BITFIELD ref_needs_init : 1; - BOOL_BITFIELD has_const_assign_ref : 1; + BOOL_BITFIELD has_const_copy_assign : 1; BOOL_BITFIELD spare : 1; }; @@ -1271,7 +1271,7 @@ struct GTY(()) lang_type_class { unsigned non_pod_class : 1; unsigned nearly_empty_p : 1; unsigned user_align : 1; - unsigned has_assign_ref : 1; + unsigned has_copy_assign : 1; unsigned has_new : 1; unsigned has_array_new : 1; @@ -1297,17 +1297,18 @@ struct GTY(()) lang_type_class { unsigned was_anonymous : 1; unsigned lazy_default_ctor : 1; unsigned lazy_copy_ctor : 1; - unsigned lazy_assignment_op : 1; + unsigned lazy_copy_assign : 1; unsigned lazy_destructor : 1; - unsigned has_const_init_ref : 1; - unsigned has_complex_init_ref : 1; - unsigned has_complex_assign_ref : 1; + unsigned has_const_copy_ctor : 1; + unsigned has_complex_copy_ctor : 1; + unsigned has_complex_copy_assign : 1; unsigned non_aggregate : 1; unsigned has_complex_dflt : 1; unsigned has_list_ctor : 1; unsigned non_std_layout : 1; unsigned lazy_move_ctor : 1; + unsigned is_literal : 1; /* When adding a flag here, consider whether or not it ought to @@ -1412,8 +1413,8 @@ struct GTY((variable_size)) lang_type { /* Nonzero means that NODE (a class type) has an assignment operator -- but that it has not yet been declared. */ -#define CLASSTYPE_LAZY_ASSIGNMENT_OP(NODE) \ - (LANG_TYPE_CLASS_CHECK (NODE)->lazy_assignment_op) +#define CLASSTYPE_LAZY_COPY_ASSIGN(NODE) \ + (LANG_TYPE_CLASS_CHECK (NODE)->lazy_copy_assign) /* Nonzero means that NODE (a class type) has a destructor -- but that it has not yet been declared. */ @@ -1421,17 +1422,17 @@ struct GTY((variable_size)) lang_type { (LANG_TYPE_CLASS_CHECK (NODE)->lazy_destructor) /* Nonzero means that this _CLASSTYPE node overloads operator=(X&). */ -#define TYPE_HAS_ASSIGN_REF(NODE) (LANG_TYPE_CLASS_CHECK (NODE)->has_assign_ref) +#define TYPE_HAS_COPY_ASSIGN(NODE) (LANG_TYPE_CLASS_CHECK (NODE)->has_copy_assign) /* True iff the class type NODE has an "operator =" whose parameter has a parameter of type "const X&". */ -#define TYPE_HAS_CONST_ASSIGN_REF(NODE) \ - (LANG_TYPE_CLASS_CHECK (NODE)->h.has_const_assign_ref) +#define TYPE_HAS_CONST_COPY_ASSIGN(NODE) \ + (LANG_TYPE_CLASS_CHECK (NODE)->h.has_const_copy_assign) /* Nonzero means that this _CLASSTYPE node has an X(X&) constructor. */ -#define TYPE_HAS_INIT_REF(NODE) (LANG_TYPE_CLASS_CHECK (NODE)->h.has_init_ref) -#define TYPE_HAS_CONST_INIT_REF(NODE) \ - (LANG_TYPE_CLASS_CHECK (NODE)->has_const_init_ref) +#define TYPE_HAS_COPY_CTOR(NODE) (LANG_TYPE_CLASS_CHECK (NODE)->h.has_copy_ctor) +#define TYPE_HAS_CONST_COPY_CTOR(NODE) \ + (LANG_TYPE_CLASS_CHECK (NODE)->has_const_copy_ctor) /* Nonzero if this class has an X(initializer_list<T>) constructor. */ #define TYPE_HAS_LIST_CTOR(NODE) \ @@ -3159,13 +3160,13 @@ more_aggr_init_expr_args_p (const aggr_init_expr_arg_iterator *iter) #define TYPE_NON_AGGREGATE_CLASS(NODE) \ (CLASS_TYPE_P (NODE) && CLASSTYPE_NON_AGGREGATE (NODE)) -/* Nonzero if there is a user-defined X::op=(x&) for this class. */ -#define TYPE_HAS_COMPLEX_ASSIGN_REF(NODE) (LANG_TYPE_CLASS_CHECK (NODE)->has_complex_assign_ref) +/* Nonzero if there is a non-trivial X::op=(cv X&) for this class. */ +#define TYPE_HAS_COMPLEX_COPY_ASSIGN(NODE) (LANG_TYPE_CLASS_CHECK (NODE)->has_complex_copy_assign) -/* Nonzero if there is a user-defined X::X(x&) for this class. */ -#define TYPE_HAS_COMPLEX_INIT_REF(NODE) (LANG_TYPE_CLASS_CHECK (NODE)->has_complex_init_ref) +/* Nonzero if there is a non-trivial X::X(cv X&) for this class. */ +#define TYPE_HAS_COMPLEX_COPY_CTOR(NODE) (LANG_TYPE_CLASS_CHECK (NODE)->has_complex_copy_ctor) -/* Nonzero if there is a user-defined default constructor for this class. */ +/* Nonzero if there is a non-trivial default constructor for this class. */ #define TYPE_HAS_COMPLEX_DFLT(NODE) (LANG_TYPE_CLASS_CHECK (NODE)->has_complex_dflt) /* Nonzero if TYPE has a trivial destructor. From [class.dtor]: @@ -3195,13 +3196,13 @@ more_aggr_init_expr_args_p (const aggr_init_expr_arg_iterator *iter) /* Nonzero for class type means that copy initialization of this type can use a bitwise copy. */ -#define TYPE_HAS_TRIVIAL_INIT_REF(NODE) \ - (TYPE_HAS_INIT_REF (NODE) && ! TYPE_HAS_COMPLEX_INIT_REF (NODE)) +#define TYPE_HAS_TRIVIAL_COPY_CTOR(NODE) \ + (TYPE_HAS_COPY_CTOR (NODE) && ! TYPE_HAS_COMPLEX_COPY_CTOR (NODE)) /* Nonzero for class type means that assignment of this type can use a bitwise copy. */ -#define TYPE_HAS_TRIVIAL_ASSIGN_REF(NODE) \ - (TYPE_HAS_ASSIGN_REF (NODE) && ! TYPE_HAS_COMPLEX_ASSIGN_REF (NODE)) +#define TYPE_HAS_TRIVIAL_COPY_ASSIGN(NODE) \ + (TYPE_HAS_COPY_ASSIGN (NODE) && ! TYPE_HAS_COMPLEX_COPY_ASSIGN (NODE)) /* Returns true if NODE is a pointer-to-data-member. */ #define TYPE_PTRMEM_P(NODE) \ @@ -3867,7 +3868,7 @@ typedef enum special_function_kind { sfk_constructor, /* A constructor. */ sfk_copy_constructor, /* A copy constructor. */ sfk_move_constructor, /* A move constructor. */ - sfk_assignment_operator, /* An assignment operator. */ + sfk_copy_assignment, /* A copy assignment operator. */ sfk_destructor, /* A destructor. */ sfk_complete_destructor, /* A destructor for complete objects. */ sfk_base_destructor, /* A destructor for base subobjects. */ diff --git a/gcc/cp/decl.c b/gcc/cp/decl.c index 48d2b69..1011243 100644 --- a/gcc/cp/decl.c +++ b/gcc/cp/decl.c @@ -3866,10 +3866,10 @@ fixup_anonymous_aggr (tree t) /* Wipe out memory of synthesized methods. */ TYPE_HAS_USER_CONSTRUCTOR (t) = 0; TYPE_HAS_DEFAULT_CONSTRUCTOR (t) = 0; - TYPE_HAS_INIT_REF (t) = 0; - TYPE_HAS_CONST_INIT_REF (t) = 0; - TYPE_HAS_ASSIGN_REF (t) = 0; - TYPE_HAS_CONST_ASSIGN_REF (t) = 0; + TYPE_HAS_COPY_CTOR (t) = 0; + TYPE_HAS_CONST_COPY_CTOR (t) = 0; + TYPE_HAS_COPY_ASSIGN (t) = 0; + TYPE_HAS_CONST_COPY_ASSIGN (t) = 0; /* Splice the implicitly generated functions out of the TYPE_METHODS list. */ @@ -3915,7 +3915,7 @@ fixup_anonymous_aggr (tree t) if (TYPE_HAS_NONTRIVIAL_DESTRUCTOR (type)) error ("member %q+#D with destructor not allowed " "in anonymous aggregate", field); - if (TYPE_HAS_COMPLEX_ASSIGN_REF (type)) + if (TYPE_HAS_COMPLEX_COPY_ASSIGN (type)) error ("member %q+#D with copy assignment operator " "not allowed in anonymous aggregate", field); } @@ -10261,11 +10261,11 @@ grok_special_member_properties (tree decl) X&, volatile X& or const volatile X&, and either there are no other parameters or else all other parameters have default arguments. */ - TYPE_HAS_INIT_REF (class_type) = 1; + TYPE_HAS_COPY_CTOR (class_type) = 1; if (user_provided_p (decl)) - TYPE_HAS_COMPLEX_INIT_REF (class_type) = 1; + TYPE_HAS_COMPLEX_COPY_CTOR (class_type) = 1; if (ctor > 1) - TYPE_HAS_CONST_INIT_REF (class_type) = 1; + TYPE_HAS_CONST_COPY_CTOR (class_type) = 1; } else if (sufficient_parms_p (FUNCTION_FIRST_USER_PARMTYPE (decl))) { @@ -10288,11 +10288,11 @@ grok_special_member_properties (tree decl) if (assop) { - TYPE_HAS_ASSIGN_REF (class_type) = 1; + TYPE_HAS_COPY_ASSIGN (class_type) = 1; if (user_provided_p (decl)) - TYPE_HAS_COMPLEX_ASSIGN_REF (class_type) = 1; + TYPE_HAS_COMPLEX_COPY_ASSIGN (class_type) = 1; if (assop != 1) - TYPE_HAS_CONST_ASSIGN_REF (class_type) = 1; + TYPE_HAS_CONST_COPY_ASSIGN (class_type) = 1; } } } diff --git a/gcc/cp/init.c b/gcc/cp/init.c index 7df57ab..85ad582 100644 --- a/gcc/cp/init.c +++ b/gcc/cp/init.c @@ -2834,7 +2834,7 @@ build_vec_init (tree base, tree maxindex, tree init, && TREE_CODE (atype) == ARRAY_TYPE && (from_array == 2 ? (!CLASS_TYPE_P (inner_elt_type) - || !TYPE_HAS_COMPLEX_ASSIGN_REF (inner_elt_type)) + || !TYPE_HAS_COMPLEX_COPY_ASSIGN (inner_elt_type)) : !TYPE_NEEDS_CONSTRUCTING (type)) && ((TREE_CODE (init) == CONSTRUCTOR /* Don't do this if the CONSTRUCTOR might contain something diff --git a/gcc/cp/method.c b/gcc/cp/method.c index 0400277..96a1d54 100644 --- a/gcc/cp/method.c +++ b/gcc/cp/method.c @@ -57,7 +57,7 @@ enum mangling_flags typedef enum mangling_flags mangling_flags; -static void do_build_assign_ref (tree); +static void do_build_copy_assign (tree); static void do_build_copy_constructor (tree); static tree synthesize_exception_spec (tree, tree (*) (tree, void *), void *); static tree make_alias_for_thunk (tree); @@ -410,11 +410,11 @@ do_build_copy_constructor (tree fndecl) parm = convert_from_reference (parm); - if (TYPE_HAS_TRIVIAL_INIT_REF (current_class_type) + if (TYPE_HAS_TRIVIAL_COPY_CTOR (current_class_type) && is_empty_class (current_class_type)) /* Don't copy the padding byte; it might not have been allocated if *this is a base subobject. */; - else if (TYPE_HAS_TRIVIAL_INIT_REF (current_class_type)) + else if (TYPE_HAS_TRIVIAL_COPY_CTOR (current_class_type)) { tree t = build2 (INIT_EXPR, void_type_node, current_class_ref, parm); finish_expr_stmt (t); @@ -508,7 +508,7 @@ do_build_copy_constructor (tree fndecl) } static void -do_build_assign_ref (tree fndecl) +do_build_copy_assign (tree fndecl) { tree parm = TREE_CHAIN (DECL_ARGUMENTS (fndecl)); tree compound_stmt; @@ -516,11 +516,11 @@ do_build_assign_ref (tree fndecl) compound_stmt = begin_compound_stmt (0); parm = convert_from_reference (parm); - if (TYPE_HAS_TRIVIAL_ASSIGN_REF (current_class_type) + if (TYPE_HAS_TRIVIAL_COPY_ASSIGN (current_class_type) && is_empty_class (current_class_type)) /* Don't copy the padding byte; it might not have been allocated if *this is a base subobject. */; - else if (TYPE_HAS_TRIVIAL_ASSIGN_REF (current_class_type)) + else if (TYPE_HAS_TRIVIAL_COPY_ASSIGN (current_class_type)) { tree t = build2 (MODIFY_EXPR, void_type_node, current_class_ref, parm); finish_expr_stmt (t); @@ -657,7 +657,7 @@ synthesize_method (tree fndecl) if (DECL_OVERLOADED_OPERATOR_P (fndecl) == NOP_EXPR) { - do_build_assign_ref (fndecl); + do_build_copy_assign (fndecl); need_body = false; } else if (DECL_CONSTRUCTOR_P (fndecl)) @@ -806,7 +806,7 @@ locate_copy (tree type, void *client_) return NULL_TREE; fns = VEC_index (tree, CLASSTYPE_METHOD_VEC (type), ix); } - else if (TYPE_HAS_INIT_REF (type)) + else if (TYPE_HAS_COPY_CTOR (type)) { /* If construction of the copy constructor was postponed, create it now. */ @@ -913,14 +913,14 @@ implicitly_declare_fn (special_function_kind kind, tree type, bool const_p) break; case sfk_copy_constructor: - case sfk_assignment_operator: + case sfk_copy_assignment: case sfk_move_constructor: { struct copy_data data; data.name = NULL; data.quals = 0; - if (kind == sfk_assignment_operator) + if (kind == sfk_copy_assignment) { return_type = build_reference_type (type); name = ansi_assopname (NOP_EXPR); @@ -1057,7 +1057,7 @@ defaultable_fn_check (tree fn) else if (DECL_ASSIGNMENT_OPERATOR_P (fn) && DECL_OVERLOADED_OPERATOR_P (fn) == NOP_EXPR && copy_fn_p (fn)) - kind = sfk_assignment_operator; + kind = sfk_copy_assignment; if (kind == sfk_none) { @@ -1108,9 +1108,9 @@ lazily_declare_fn (special_function_kind sfk, tree type) /* Figure out whether or not the argument has a const reference type. */ if (sfk == sfk_copy_constructor) - const_p = TYPE_HAS_CONST_INIT_REF (type); - else if (sfk == sfk_assignment_operator) - const_p = TYPE_HAS_CONST_ASSIGN_REF (type); + const_p = TYPE_HAS_CONST_COPY_CTOR (type); + else if (sfk == sfk_copy_assignment) + const_p = TYPE_HAS_CONST_COPY_ASSIGN (type); else /* In this case, CONST_P will be ignored. */ const_p = false; @@ -1118,7 +1118,7 @@ lazily_declare_fn (special_function_kind sfk, tree type) fn = implicitly_declare_fn (sfk, type, const_p); /* A destructor may be virtual. */ if (sfk == sfk_destructor - || sfk == sfk_assignment_operator) + || sfk == sfk_copy_assignment) check_for_override (fn, type); /* Add it to CLASSTYPE_METHOD_VEC. */ add_method (type, fn, NULL_TREE); @@ -1143,8 +1143,8 @@ lazily_declare_fn (special_function_kind sfk, tree type) TYPE_METHODS (type) = fn; } maybe_add_class_template_decl_list (type, fn, /*friend_p=*/0); - if (sfk == sfk_assignment_operator) - CLASSTYPE_LAZY_ASSIGNMENT_OP (type) = 0; + if (sfk == sfk_copy_assignment) + CLASSTYPE_LAZY_COPY_ASSIGN (type) = 0; else { /* Remember that the function has been created. */ diff --git a/gcc/cp/pt.c b/gcc/cp/pt.c index e4b57db..09d077a 100644 --- a/gcc/cp/pt.c +++ b/gcc/cp/pt.c @@ -7809,10 +7809,10 @@ instantiate_class_template (tree type) TYPE_HAS_NEW_OPERATOR (type) = TYPE_HAS_NEW_OPERATOR (pattern); TYPE_HAS_ARRAY_NEW_OPERATOR (type) = TYPE_HAS_ARRAY_NEW_OPERATOR (pattern); TYPE_GETS_DELETE (type) = TYPE_GETS_DELETE (pattern); - TYPE_HAS_ASSIGN_REF (type) = TYPE_HAS_ASSIGN_REF (pattern); - TYPE_HAS_CONST_ASSIGN_REF (type) = TYPE_HAS_CONST_ASSIGN_REF (pattern); - TYPE_HAS_INIT_REF (type) = TYPE_HAS_INIT_REF (pattern); - TYPE_HAS_CONST_INIT_REF (type) = TYPE_HAS_CONST_INIT_REF (pattern); + TYPE_HAS_COPY_ASSIGN (type) = TYPE_HAS_COPY_ASSIGN (pattern); + TYPE_HAS_CONST_COPY_ASSIGN (type) = TYPE_HAS_CONST_COPY_ASSIGN (pattern); + TYPE_HAS_COPY_CTOR (type) = TYPE_HAS_COPY_CTOR (pattern); + TYPE_HAS_CONST_COPY_CTOR (type) = TYPE_HAS_CONST_COPY_CTOR (pattern); TYPE_HAS_DEFAULT_CONSTRUCTOR (type) = TYPE_HAS_DEFAULT_CONSTRUCTOR (pattern); TYPE_HAS_CONVERSION (type) = TYPE_HAS_CONVERSION (pattern); TYPE_PACKED (type) = TYPE_PACKED (pattern); diff --git a/gcc/cp/ptree.c b/gcc/cp/ptree.c index a1fa71f..c2493c7 100644 --- a/gcc/cp/ptree.c +++ b/gcc/cp/ptree.c @@ -124,9 +124,9 @@ cxx_print_type (FILE *file, tree node, int indent) fputs (" X()", file); if (TYPE_HAS_CONVERSION (node)) fputs (" has-type-conversion", file); - if (TYPE_HAS_INIT_REF (node)) + if (TYPE_HAS_COPY_CTOR (node)) { - if (TYPE_HAS_CONST_INIT_REF (node)) + if (TYPE_HAS_CONST_COPY_CTOR (node)) fputs (" X(constX&)", file); else fputs (" X(X&)", file); @@ -139,7 +139,7 @@ cxx_print_type (FILE *file, tree node, int indent) fputs (" delete", file); if (TYPE_GETS_DELETE (node) & 2) fputs (" delete[]", file); - if (TYPE_HAS_ASSIGN_REF (node)) + if (TYPE_HAS_COPY_ASSIGN (node)) fputs (" this=(X&)", file); if (CLASSTYPE_SORTED_FIELDS (node)) fprintf (file, " sorted-fields %p", diff --git a/gcc/cp/search.c b/gcc/cp/search.c index d69d415..d291c08 100644 --- a/gcc/cp/search.c +++ b/gcc/cp/search.c @@ -1362,8 +1362,8 @@ lookup_fnfields_1 (tree type, tree name) lazily_declare_fn (sfk_move_constructor, type); } else if (name == ansi_assopname(NOP_EXPR) - && CLASSTYPE_LAZY_ASSIGNMENT_OP (type)) - lazily_declare_fn (sfk_assignment_operator, type); + && CLASSTYPE_LAZY_COPY_ASSIGN (type)) + lazily_declare_fn (sfk_copy_assignment, type); else if ((name == dtor_identifier || name == base_dtor_identifier || name == complete_dtor_identifier diff --git a/gcc/cp/semantics.c b/gcc/cp/semantics.c index 8baf76a..9dae90b 100644 --- a/gcc/cp/semantics.c +++ b/gcc/cp/semantics.c @@ -3570,7 +3570,7 @@ cxx_omp_create_clause_info (tree c, tree type, bool need_default_ctor, CP_OMP_CLAUSE_INFO (c) = info; if (need_default_ctor - || (need_copy_ctor && !TYPE_HAS_TRIVIAL_INIT_REF (type))) + || (need_copy_ctor && !TYPE_HAS_TRIVIAL_COPY_CTOR (type))) { VEC(tree,gc) *vec; @@ -3624,7 +3624,7 @@ cxx_omp_create_clause_info (tree c, tree type, bool need_default_ctor, TREE_VEC_ELT (info, 1) = omp_clause_info_fndecl (t, type); } - if (need_copy_assignment && !TYPE_HAS_TRIVIAL_ASSIGN_REF (type)) + if (need_copy_assignment && !TYPE_HAS_TRIVIAL_COPY_ASSIGN (type)) { VEC(tree,gc) *vec; @@ -5011,7 +5011,7 @@ classtype_has_nothrow_assign_or_copy_p (tree type, bool assign_p) return false; fns = VEC_index (tree, CLASSTYPE_METHOD_VEC (type), ix); } - else if (TYPE_HAS_INIT_REF (type)) + else if (TYPE_HAS_COPY_CTOR (type)) { /* If construction of the copy constructor was postponed, create it now. */ @@ -5070,7 +5070,7 @@ trait_expr_value (cp_trait_kind kind, tree type1, tree type2) return (!CP_TYPE_CONST_P (type1) && type_code1 != REFERENCE_TYPE && (trivial_type_p (type1) || (CLASS_TYPE_P (type1) - && TYPE_HAS_TRIVIAL_ASSIGN_REF (type1)))); + && TYPE_HAS_TRIVIAL_COPY_ASSIGN (type1)))); case CPTK_HAS_NOTHROW_CONSTRUCTOR: type1 = strip_array_types (type1); @@ -5095,7 +5095,7 @@ trait_expr_value (cp_trait_kind kind, tree type1, tree type2) type" wording for this trait. */ type1 = strip_array_types (type1); return (trivial_type_p (type1) || type_code1 == REFERENCE_TYPE - || (CLASS_TYPE_P (type1) && TYPE_HAS_TRIVIAL_INIT_REF (type1))); + || (CLASS_TYPE_P (type1) && TYPE_HAS_TRIVIAL_COPY_CTOR (type1))); case CPTK_HAS_TRIVIAL_DESTRUCTOR: type1 = strip_array_types (type1); diff --git a/gcc/cp/tree.c b/gcc/cp/tree.c index 2971283..f7ce655 100644 --- a/gcc/cp/tree.c +++ b/gcc/cp/tree.c @@ -479,7 +479,7 @@ build_target_expr_with_type (tree init, tree type) if (TREE_CODE (init) == TARGET_EXPR) return init; - else if (CLASS_TYPE_P (type) && !TYPE_HAS_TRIVIAL_INIT_REF (type) + else if (CLASS_TYPE_P (type) && !TYPE_HAS_TRIVIAL_COPY_CTOR (type) && !VOID_TYPE_P (TREE_TYPE (init)) && TREE_CODE (init) != COND_EXPR && TREE_CODE (init) != CONSTRUCTOR @@ -2376,7 +2376,7 @@ type_has_nontrivial_copy_init (const_tree t) t = strip_array_types (CONST_CAST_TREE (t)); if (CLASS_TYPE_P (t)) - return TYPE_HAS_COMPLEX_INIT_REF (t); + return TYPE_HAS_COMPLEX_COPY_CTOR (t); else return 0; } @@ -2390,8 +2390,8 @@ trivial_type_p (const_tree t) if (CLASS_TYPE_P (t)) return (TYPE_HAS_TRIVIAL_DFLT (t) - && TYPE_HAS_TRIVIAL_INIT_REF (t) - && TYPE_HAS_TRIVIAL_ASSIGN_REF (t) + && TYPE_HAS_TRIVIAL_COPY_CTOR (t) + && TYPE_HAS_TRIVIAL_COPY_ASSIGN (t) && TYPE_HAS_TRIVIAL_DESTRUCTOR (t)); else return scalarish_type_p (t); @@ -2832,7 +2832,7 @@ special_function_p (const_tree decl) if (DECL_CONSTRUCTOR_P (decl)) return sfk_constructor; if (DECL_OVERLOADED_OPERATOR_P (decl) == NOP_EXPR) - return sfk_assignment_operator; + return sfk_copy_assignment; if (DECL_MAYBE_IN_CHARGE_DESTRUCTOR_P (decl)) return sfk_destructor; if (DECL_COMPLETE_DESTRUCTOR_P (decl)) diff --git a/gcc/cp/typeck2.c b/gcc/cp/typeck2.c index 9526aba..c8dae54 100644 --- a/gcc/cp/typeck2.c +++ b/gcc/cp/typeck2.c @@ -714,7 +714,7 @@ store_init_value (tree decl, tree init, int flags) if (MAYBE_CLASS_TYPE_P (type)) { - gcc_assert (TYPE_HAS_TRIVIAL_INIT_REF (type) + gcc_assert (TYPE_HAS_TRIVIAL_COPY_CTOR (type) || TREE_CODE (init) == CONSTRUCTOR); if (TREE_CODE (init) == TREE_LIST) |