cp-tree.h (CLASSTYPE_DESTRUCTORS): Rename to ...

* cp-tree.h (CLASSTYPE_DESTRUCTORS): Rename to ...
	(CLASSTYPE_DESTRUCTOR): ... this.
	* class.c (accessible_nvdtor_p)
	maybe_warn_about_overly_private_class,
	add_implicitly_declared_members,
	clone_constructors_and_destructors, type_has_virtual_destructor):
	Adjust for CLASSTYPE_DESTRUCTOR.
	(deduce_noexcept_on_destructors): Absorb into ...
	(check_bases_and_members): ... here.
	* except.c (dtor_nothrow): Adjust for CLASSTYPE_DESTRUCTOR.
	* init.c (build_delete): Likewise.
	* parser.c (cp_parser_lookup_name): Likewise.
	* pt.c (check_explicit_specialization): Likewise.
	* rtti.c (emit_support_tinfos): Likewise.
	* search.c (lookup_fnfields_idx_nolazy): Likewise.
(--This line, and those below, will be ignored--

M    cp/cp-tree.h
M    cp/search.c
M    cp/init.c
M    cp/class.c
M    cp/rtti.c
M    cp/except.c
M    cp/ChangeLog
M    cp/pt.c
M    cp/parser.c

From-SVN: r249701
This commit is contained in:
Nathan Sidwell 2017-06-27 17:27:49 +00:00 committed by Nathan Sidwell
parent 68fe5f441e
commit b2cf76f3a5
9 changed files with 45 additions and 47 deletions

View File

@ -1,5 +1,21 @@
2017-06-27 Nathan Sidwell <nathan@acm.org>
* cp-tree.h (CLASSTYPE_DESTRUCTORS): Rename to ...
(CLASSTYPE_DESTRUCTOR): ... this.
* class.c (accessible_nvdtor_p,
maybe_warn_about_overly_private_class,
add_implicitly_declared_members,
clone_constructors_and_destructors, type_has_virtual_destructor):
Adjust for CLASSTYPE_DESTRUCTOR.
(deduce_noexcept_on_destructors): Absorb into ...
(check_bases_and_members): ... here.
* except.c (dtor_nothrow): Adjust for CLASSTYPE_DESTRUCTOR.
* init.c (build_delete): Likewise.
* parser.c (cp_parser_lookup_name): Likewise.
* pt.c (check_explicit_specialization): Likewise.
* rtti.c (emit_support_tinfos): Likewise.
* search.c (lookup_fnfields_idx_nolazy): Likewise.
Kill IDENTIFIER_TEMPLATE.
* cp-tree.h (lang_identifier): Remove class_template_info field.
(IDENTIFIER_TEMPLATE): Delete.

View File

@ -1711,7 +1711,7 @@ inherit_targ_abi_tags (tree t)
static bool
accessible_nvdtor_p (tree t)
{
tree dtor = CLASSTYPE_DESTRUCTORS (t);
tree dtor = CLASSTYPE_DESTRUCTOR (t);
/* An implicitly declared destructor is always public. And,
if it were virtual, we would have created it by now. */
@ -2220,7 +2220,7 @@ maybe_warn_about_overly_private_class (tree t)
/* Even if some of the member functions are non-private, the class
won't be useful for much if all the constructors or destructors
are private: such an object can never be created or destroyed. */
fn = CLASSTYPE_DESTRUCTORS (t);
fn = CLASSTYPE_DESTRUCTOR (t);
if (fn && TREE_PRIVATE (fn))
{
warning (OPT_Wctor_dtor_privacy,
@ -3366,18 +3366,17 @@ add_implicitly_declared_members (tree t, tree* access_decls,
int cant_have_const_cctor,
int cant_have_const_assignment)
{
bool move_ok = false;
/* Destructor. */
if (!CLASSTYPE_DESTRUCTOR (t))
/* In general, we create destructors lazily. */
CLASSTYPE_LAZY_DESTRUCTOR (t) = 1;
if (cxx_dialect >= cxx11 && !CLASSTYPE_DESTRUCTORS (t)
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))
move_ok = true;
/* Destructor. */
if (!CLASSTYPE_DESTRUCTORS (t))
/* In general, we create destructors lazily. */
CLASSTYPE_LAZY_DESTRUCTOR (t) = 1;
/* [class.ctor]
If there is no user-declared constructor for a class, a default
@ -5015,8 +5014,9 @@ clone_constructors_and_destructors (tree t)
we no longer need to know that. */
for (ovl_iterator iter (CLASSTYPE_CONSTRUCTORS (t)); iter; ++iter)
clone_function_decl (*iter, /*update_methods=*/true);
for (ovl_iterator iter (CLASSTYPE_DESTRUCTORS (t)); iter; ++iter)
clone_function_decl (*iter, /*update_methods=*/true);
if (tree dtor = CLASSTYPE_DESTRUCTOR (t))
clone_function_decl (dtor, /*update_methods=*/true);
}
/* Deduce noexcept for a destructor DTOR. */
@ -5029,24 +5029,6 @@ deduce_noexcept_on_destructor (tree dtor)
noexcept_deferred_spec);
}
/* For each destructor in T, deduce noexcept:
12.4/3: A declaration of a destructor that does not have an
exception-specification is implicitly considered to have the
same exception-specification as an implicit declaration (15.4). */
static void
deduce_noexcept_on_destructors (tree t)
{
/* If for some reason we don't have a CLASSTYPE_METHOD_VEC, we bail
out now. */
if (!CLASSTYPE_METHOD_VEC (t))
return;
for (ovl_iterator iter (CLASSTYPE_DESTRUCTORS (t)); iter; ++iter)
deduce_noexcept_on_destructor (*iter);
}
/* Subroutine of set_one_vmethod_tm_attributes. Search base classes
of TYPE for virtual functions which FNDECL overrides. Return a
mask of the tm attributes found therein. */
@ -5460,7 +5442,7 @@ type_has_virtual_destructor (tree type)
return false;
gcc_assert (COMPLETE_TYPE_P (type));
dtor = CLASSTYPE_DESTRUCTORS (type);
dtor = CLASSTYPE_DESTRUCTOR (type);
return (dtor && DECL_VIRTUAL_P (dtor));
}
@ -5851,10 +5833,11 @@ check_bases_and_members (tree t)
of potential interest. */
check_bases (t, &cant_have_const_ctor, &no_const_asn_ref);
/* Deduce noexcept on destructors. This needs to happen after we've set
/* Deduce noexcept on destructor. This needs to happen after we've set
triviality flags appropriately for our bases. */
if (cxx_dialect >= cxx11)
deduce_noexcept_on_destructors (t);
if (tree dtor = CLASSTYPE_DESTRUCTOR (t))
deduce_noexcept_on_destructor (dtor);
/* Check all the method declarations. */
check_methods (t);

View File

@ -2145,11 +2145,11 @@ struct GTY(()) lang_type {
#define CLASSTYPE_CONSTRUCTORS(NODE) \
((*CLASSTYPE_METHOD_VEC (NODE))[CLASSTYPE_CONSTRUCTOR_SLOT])
/* A FUNCTION_DECL for the destructor for NODE. These are the
/* A FUNCTION_DECL for the destructor for NODE. This is the
destructors that take an in-charge parameter. If
CLASSTYPE_LAZY_DESTRUCTOR is true, then this entry will be NULL
until the destructor is created with lazily_declare_fn. */
#define CLASSTYPE_DESTRUCTORS(NODE) \
#define CLASSTYPE_DESTRUCTOR(NODE) \
(CLASSTYPE_METHOD_VEC (NODE) \
? (*CLASSTYPE_METHOD_VEC (NODE))[CLASSTYPE_DESTRUCTOR_SLOT] \
: NULL_TREE)
@ -2179,11 +2179,9 @@ struct GTY(()) lang_type {
/* The type corresponding to NODE when NODE is used as a base class,
i.e., NODE without virtual base classes or tail padding. */
#define CLASSTYPE_AS_BASE(NODE) (LANG_TYPE_CLASS_CHECK (NODE)->as_base)
/* True iff NODE is the CLASSTYPE_AS_BASE version of some type. */
#define IS_FAKE_BASE_TYPE(NODE) \
(TREE_CODE (NODE) == RECORD_TYPE \
&& TYPE_CONTEXT (NODE) && CLASS_TYPE_P (TYPE_CONTEXT (NODE)) \

View File

@ -218,7 +218,7 @@ dtor_nothrow (tree type)
if (CLASSTYPE_LAZY_DESTRUCTOR (type))
lazily_declare_fn (sfk_destructor, type);
return TREE_NOTHROW (CLASSTYPE_DESTRUCTORS (type));
return TREE_NOTHROW (CLASSTYPE_DESTRUCTOR (type));
}
/* Build up a call to __cxa_end_catch, to destroy the exception object

View File

@ -4580,8 +4580,7 @@ build_delete (tree otype, tree addr, special_function_kind auto_delete,
&& MAYBE_CLASS_TYPE_P (type) && !CLASSTYPE_FINAL (type)
&& TYPE_POLYMORPHIC_P (type))
{
tree dtor;
dtor = CLASSTYPE_DESTRUCTORS (type);
tree dtor = CLASSTYPE_DESTRUCTOR (type);
if (!dtor || !DECL_VINDEX (dtor))
{
if (CLASSTYPE_PURE_VIRTUALS (type))
@ -4671,7 +4670,7 @@ build_delete (tree otype, tree addr, special_function_kind auto_delete,
/* If the destructor is non-virtual, there is no deleting
variant. Instead, we must explicitly call the appropriate
`operator delete' here. */
else if (!DECL_VIRTUAL_P (CLASSTYPE_DESTRUCTORS (type))
else if (!DECL_VIRTUAL_P (CLASSTYPE_DESTRUCTOR (type))
&& auto_delete == sfk_deleting_destructor)
{
/* We will use ADDR multiple times so we must save it. */

View File

@ -25679,12 +25679,14 @@ cp_parser_lookup_name (cp_parser *parser, tree name,
/* If that's not a class type, there is no destructor. */
if (!type || !CLASS_TYPE_P (type))
return error_mark_node;
if (CLASSTYPE_LAZY_DESTRUCTOR (type))
lazily_declare_fn (sfk_destructor, type);
if (!CLASSTYPE_DESTRUCTORS (type))
return error_mark_node;
/* If it was a class type, return the destructor. */
return CLASSTYPE_DESTRUCTORS (type);
if (tree dtor = CLASSTYPE_DESTRUCTOR (type))
return dtor;
return error_mark_node;
}
/* By this point, the NAME should be an ordinary identifier. If

View File

@ -2884,7 +2884,7 @@ check_explicit_specialization (tree declarator,
int is_constructor = DECL_CONSTRUCTOR_P (decl);
if (is_constructor ? !TYPE_HAS_USER_CONSTRUCTOR (ctype)
: !CLASSTYPE_DESTRUCTORS (ctype))
: !CLASSTYPE_DESTRUCTOR (ctype))
{
/* From [temp.expl.spec]:

View File

@ -1556,7 +1556,7 @@ emit_support_tinfos (void)
bltn_type = TREE_TYPE (bltn_type);
if (!COMPLETE_TYPE_P (bltn_type))
return;
tree dtor = CLASSTYPE_DESTRUCTORS (bltn_type);
tree dtor = CLASSTYPE_DESTRUCTOR (bltn_type);
if (!dtor || DECL_EXTERNAL (dtor))
return;

View File

@ -1592,7 +1592,7 @@ lookup_fnfields_idx_nolazy (tree type, tree name)
/* and destructors are second. */
if (name == dtor_identifier)
{
fn = CLASSTYPE_DESTRUCTORS (type);
fn = CLASSTYPE_DESTRUCTOR (type);
return fn ? CLASSTYPE_DESTRUCTOR_SLOT : -1;
}
if (IDENTIFIER_CONV_OP_P (name))