From: Nathan Sidwell Date: Tue, 18 Jul 2017 12:05:12 +0000 (+0000) Subject: class.c (classtype_has_move_assign_or_move_ctor): Declare. X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=6b8e738ef0d43329a642f2e17fe4112a6af8701d;p=gcc.git class.c (classtype_has_move_assign_or_move_ctor): Declare. * class.c (classtype_has_move_assign_or_move_ctor): Declare. (add_implicitly_declared_members): Use it. (type_has_move_constructor, type_has_move_assign): Merge into ... (classtype_has_move_assign_or_move_ctor): ... this new function. * cp-tree.h (type_has_move_constructor, type_has_move_assign): Delete. From-SVN: r250305 --- diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index e46c1286732..9ecdf469d28 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -1,3 +1,11 @@ +2017-07-18 Nathan Sidwell + + * class.c (classtype_has_move_assign_or_move_ctor): Declare. + (add_implicitly_declared_members): Use it. + (type_has_move_constructor, type_has_move_assign): Merge into ... + (classtype_has_move_assign_or_move_ctor): ... this new function. + * cp-tree.h (type_has_move_constructor, type_has_move_assign): Delete. + 2017-07-17 Volker Reichelt * parser.c (cp_parser_decl_specifier_seq): Add fix-it hints for diff --git a/gcc/cp/class.c b/gcc/cp/class.c index 0336ae5f143..885322c9b42 100644 --- a/gcc/cp/class.c +++ b/gcc/cp/class.c @@ -150,6 +150,7 @@ static void build_base_fields (record_layout_info, splay_tree, tree *); static void check_methods (tree); static void remove_zero_width_bit_fields (tree); static bool accessible_nvdtor_p (tree); +static bool classtype_has_move_assign_or_move_ctor (tree); /* Used by find_flexarrays and related functions. */ struct flexmems_t; @@ -3384,7 +3385,7 @@ add_implicitly_declared_members (tree t, tree* access_decls, bool move_ok = false; if (cxx_dialect >= cxx11 && CLASSTYPE_LAZY_DESTRUCTOR (t) && !TYPE_HAS_COPY_CTOR (t) && !TYPE_HAS_COPY_ASSIGN (t) - && !type_has_move_constructor (t) && !type_has_move_assign (t)) + && !classtype_has_move_assign_or_move_ctor (t)) move_ok = true; /* [class.ctor] @@ -5456,38 +5457,19 @@ type_has_virtual_destructor (tree type) return (dtor && DECL_VIRTUAL_P (dtor)); } -/* Returns true iff class T has a move constructor. */ +/* Returns true iff class T has move assignment or move constructor. */ -bool -type_has_move_constructor (tree t) +static bool +classtype_has_move_assign_or_move_ctor (tree t) { - if (CLASSTYPE_LAZY_MOVE_CTOR (t)) - { - gcc_assert (COMPLETE_TYPE_P (t)); - lazily_declare_fn (sfk_move_constructor, t); - } + gcc_assert (!CLASSTYPE_LAZY_MOVE_CTOR (t) + && !CLASSTYPE_LAZY_MOVE_ASSIGN (t)); - if (!CLASSTYPE_METHOD_VEC (t)) - return false; - - for (ovl_iterator iter (CLASSTYPE_CONSTRUCTORS (t)); iter; ++iter) + for (ovl_iterator iter (lookup_fnfields_slot_nolazy + (t, ctor_identifier)); iter; ++iter) if (move_fn_p (*iter)) return true; - return false; -} - -/* Returns true iff class T has a move assignment operator. */ - -bool -type_has_move_assign (tree t) -{ - if (CLASSTYPE_LAZY_MOVE_ASSIGN (t)) - { - gcc_assert (COMPLETE_TYPE_P (t)); - lazily_declare_fn (sfk_move_assignment, t); - } - for (ovl_iterator iter (lookup_fnfields_slot_nolazy (t, cp_assignment_operator_id (NOP_EXPR))); iter; ++iter) diff --git a/gcc/cp/cp-tree.h b/gcc/cp/cp-tree.h index 0da8a5c59b7..abc9b65b018 100644 --- a/gcc/cp/cp-tree.h +++ b/gcc/cp/cp-tree.h @@ -6023,8 +6023,6 @@ extern tree default_init_uninitialized_part (tree); extern bool trivial_default_constructor_is_constexpr (tree); extern bool type_has_constexpr_default_constructor (tree); extern bool type_has_virtual_destructor (tree); -extern bool type_has_move_constructor (tree); -extern bool type_has_move_assign (tree); extern bool classtype_has_user_move_assign_or_move_ctor_p (tree); extern bool type_build_ctor_call (tree); extern bool type_build_dtor_call (tree);