Commit 5f150326 by Paolo Carlini Committed by Paolo Carlini

cp-tree.h (DECL_MAYBE_IN_CHARGE_CDTOR_P): New.

2018-05-15  Paolo Carlini  <paolo.carlini@oracle.com>

	* cp-tree.h (DECL_MAYBE_IN_CHARGE_CDTOR_P): New.
	(FOR_EACH_CLONE): Update.
	* decl.c (grokdeclarator): Use it.
	* decl2.c (vague_linkage_p): Likewise.
	* mangle.c (mangle_decl): Likewise.
	* method.c (lazily_declare_fn): Likewise.
	* optimize.c (can_alias_cdtor, maybe_clone_body): Likewise.
	* repo.c (repo_emit_p): Likewise.
	* tree.c (decl_linkage): Likewise.

From-SVN: r260264
parent 5a7960da
2018-05-15 Paolo Carlini <paolo.carlini@oracle.com>
* cp-tree.h (DECL_MAYBE_IN_CHARGE_CDTOR_P): New.
(FOR_EACH_CLONE): Update.
* decl.c (grokdeclarator): Use it.
* decl2.c (vague_linkage_p): Likewise.
* mangle.c (mangle_decl): Likewise.
* method.c (lazily_declare_fn): Likewise.
* optimize.c (can_alias_cdtor, maybe_clone_body): Likewise.
* repo.c (repo_emit_p): Likewise.
* tree.c (decl_linkage): Likewise.
2018-05-14 Jason Merrill <jason@redhat.com> 2018-05-14 Jason Merrill <jason@redhat.com>
Handle TYPE_HAS_LATE_RETURN_TYPE like ref-qualifier and eh spec. Handle TYPE_HAS_LATE_RETURN_TYPE like ref-qualifier and eh spec.
......
...@@ -2783,6 +2783,12 @@ struct GTY(()) lang_decl { ...@@ -2783,6 +2783,12 @@ struct GTY(()) lang_decl {
#define DECL_DELETING_DESTRUCTOR_P(NODE) \ #define DECL_DELETING_DESTRUCTOR_P(NODE) \
(DECL_NAME (NODE) == deleting_dtor_identifier) (DECL_NAME (NODE) == deleting_dtor_identifier)
/* Nonzero if either DECL_MAYBE_IN_CHARGE_CONSTRUCTOR_P or
DECL_MAYBE_IN_CHARGE_DESTRUCTOR_P is true of NODE. */
#define DECL_MAYBE_IN_CHARGE_CDTOR_P(NODE) \
(DECL_MAYBE_IN_CHARGE_CONSTRUCTOR_P (NODE) \
|| DECL_MAYBE_IN_CHARGE_DESTRUCTOR_P (NODE))
/* Nonzero if NODE (a FUNCTION_DECL) is a cloned constructor or /* Nonzero if NODE (a FUNCTION_DECL) is a cloned constructor or
destructor. */ destructor. */
#define DECL_CLONED_FUNCTION_P(NODE) (!!decl_cloned_function_p (NODE, true)) #define DECL_CLONED_FUNCTION_P(NODE) (!!decl_cloned_function_p (NODE, true))
...@@ -2800,8 +2806,7 @@ struct GTY(()) lang_decl { ...@@ -2800,8 +2806,7 @@ struct GTY(()) lang_decl {
*/ */
#define FOR_EACH_CLONE(CLONE, FN) \ #define FOR_EACH_CLONE(CLONE, FN) \
if (!(TREE_CODE (FN) == FUNCTION_DECL \ if (!(TREE_CODE (FN) == FUNCTION_DECL \
&& (DECL_MAYBE_IN_CHARGE_CONSTRUCTOR_P (FN) \ && DECL_MAYBE_IN_CHARGE_CDTOR_P (FN))) \
|| DECL_MAYBE_IN_CHARGE_DESTRUCTOR_P (FN))))\
; \ ; \
else \ else \
for (CLONE = DECL_CHAIN (FN); \ for (CLONE = DECL_CHAIN (FN); \
......
...@@ -11721,9 +11721,7 @@ grokdeclarator (const cp_declarator *declarator, ...@@ -11721,9 +11721,7 @@ grokdeclarator (const cp_declarator *declarator,
{ {
if (!current_function_decl) if (!current_function_decl)
DECL_CONTEXT (decl) = FROB_CONTEXT (current_namespace); DECL_CONTEXT (decl) = FROB_CONTEXT (current_namespace);
else if (DECL_MAYBE_IN_CHARGE_CONSTRUCTOR_P (current_function_decl) else if (DECL_MAYBE_IN_CHARGE_CDTOR_P (current_function_decl))
|| (DECL_MAYBE_IN_CHARGE_DESTRUCTOR_P
(current_function_decl)))
/* The TYPE_DECL is "abstract" because there will be /* The TYPE_DECL is "abstract" because there will be
clones of this constructor/destructor, and there will clones of this constructor/destructor, and there will
be copies of this TYPE_DECL generated in those be copies of this TYPE_DECL generated in those
......
...@@ -1933,8 +1933,7 @@ vague_linkage_p (tree decl) ...@@ -1933,8 +1933,7 @@ vague_linkage_p (tree decl)
maybe-in-charge 'tor variants; in that case we need to check one of maybe-in-charge 'tor variants; in that case we need to check one of
the "clones" for the real linkage. But only in that case; before the "clones" for the real linkage. But only in that case; before
maybe_clone_body we haven't yet copied the linkage to the clones. */ maybe_clone_body we haven't yet copied the linkage to the clones. */
if ((DECL_MAYBE_IN_CHARGE_DESTRUCTOR_P (decl) if (DECL_MAYBE_IN_CHARGE_CDTOR_P (decl)
|| DECL_MAYBE_IN_CHARGE_CONSTRUCTOR_P (decl))
&& !DECL_ABSTRACT_P (decl) && !DECL_ABSTRACT_P (decl)
&& DECL_CHAIN (decl) && DECL_CHAIN (decl)
&& DECL_CLONED_FUNCTION_P (DECL_CHAIN (decl))) && DECL_CLONED_FUNCTION_P (DECL_CHAIN (decl)))
......
...@@ -3862,8 +3862,7 @@ mangle_decl (const tree decl) ...@@ -3862,8 +3862,7 @@ mangle_decl (const tree decl)
if (id != DECL_NAME (decl) if (id != DECL_NAME (decl)
/* Don't do this for a fake symbol we aren't going to emit anyway. */ /* Don't do this for a fake symbol we aren't going to emit anyway. */
&& TREE_CODE (decl) != TYPE_DECL && TREE_CODE (decl) != TYPE_DECL
&& !DECL_MAYBE_IN_CHARGE_CONSTRUCTOR_P (decl) && !DECL_MAYBE_IN_CHARGE_CDTOR_P (decl))
&& !DECL_MAYBE_IN_CHARGE_DESTRUCTOR_P (decl))
{ {
int save_ver = flag_abi_version; int save_ver = flag_abi_version;
tree id2 = NULL_TREE; tree id2 = NULL_TREE;
......
...@@ -2422,8 +2422,7 @@ lazily_declare_fn (special_function_kind sfk, tree type) ...@@ -2422,8 +2422,7 @@ lazily_declare_fn (special_function_kind sfk, tree type)
fixup_type_variants (type); fixup_type_variants (type);
maybe_add_class_template_decl_list (type, fn, /*friend_p=*/0); maybe_add_class_template_decl_list (type, fn, /*friend_p=*/0);
if (DECL_MAYBE_IN_CHARGE_CONSTRUCTOR_P (fn) if (DECL_MAYBE_IN_CHARGE_CDTOR_P (fn))
|| DECL_MAYBE_IN_CHARGE_DESTRUCTOR_P (fn))
/* Create appropriate clones. */ /* Create appropriate clones. */
clone_function_decl (fn, /*update_methods=*/true); clone_function_decl (fn, /*update_methods=*/true);
......
...@@ -194,8 +194,7 @@ can_alias_cdtor (tree fn) ...@@ -194,8 +194,7 @@ can_alias_cdtor (tree fn)
/* ??? Why not use aliases with -frepo? */ /* ??? Why not use aliases with -frepo? */
if (flag_use_repository) if (flag_use_repository)
return false; return false;
gcc_assert (DECL_MAYBE_IN_CHARGE_CONSTRUCTOR_P (fn) gcc_assert (DECL_MAYBE_IN_CHARGE_CDTOR_P (fn));
|| DECL_MAYBE_IN_CHARGE_DESTRUCTOR_P (fn));
/* Don't use aliases for weak/linkonce definitions unless we can put both /* Don't use aliases for weak/linkonce definitions unless we can put both
symbols in the same COMDAT group. */ symbols in the same COMDAT group. */
return (DECL_INTERFACE_KNOWN (fn) return (DECL_INTERFACE_KNOWN (fn)
...@@ -440,8 +439,7 @@ maybe_clone_body (tree fn) ...@@ -440,8 +439,7 @@ maybe_clone_body (tree fn)
bool need_alias = false; bool need_alias = false;
/* We only clone constructors and destructors. */ /* We only clone constructors and destructors. */
if (!DECL_MAYBE_IN_CHARGE_CONSTRUCTOR_P (fn) if (!DECL_MAYBE_IN_CHARGE_CDTOR_P (fn))
&& !DECL_MAYBE_IN_CHARGE_DESTRUCTOR_P (fn))
return 0; return 0;
populate_clone_array (fn, fns); populate_clone_array (fn, fns);
......
...@@ -330,8 +330,7 @@ repo_emit_p (tree decl) ...@@ -330,8 +330,7 @@ repo_emit_p (tree decl)
/* For constructors and destructors, the repository contains /* For constructors and destructors, the repository contains
information about the clones -- not the original function -- information about the clones -- not the original function --
because only the clones are emitted in the object file. */ because only the clones are emitted in the object file. */
if (DECL_MAYBE_IN_CHARGE_CONSTRUCTOR_P (decl) if (DECL_MAYBE_IN_CHARGE_CDTOR_P (decl))
|| DECL_MAYBE_IN_CHARGE_DESTRUCTOR_P (decl))
{ {
int emit_p = 0; int emit_p = 0;
tree clone; tree clone;
......
...@@ -5012,8 +5012,7 @@ decl_linkage (tree decl) ...@@ -5012,8 +5012,7 @@ decl_linkage (tree decl)
/* maybe_thunk_body clears TREE_PUBLIC on the maybe-in-charge 'tor variants, /* maybe_thunk_body clears TREE_PUBLIC on the maybe-in-charge 'tor variants,
check one of the "clones" for the real linkage. */ check one of the "clones" for the real linkage. */
if ((DECL_MAYBE_IN_CHARGE_DESTRUCTOR_P (decl) if (DECL_MAYBE_IN_CHARGE_CDTOR_P (decl)
|| DECL_MAYBE_IN_CHARGE_CONSTRUCTOR_P (decl))
&& DECL_CHAIN (decl) && DECL_CHAIN (decl)
&& DECL_CLONED_FUNCTION_P (DECL_CHAIN (decl))) && DECL_CLONED_FUNCTION_P (DECL_CHAIN (decl)))
return decl_linkage (DECL_CHAIN (decl)); return decl_linkage (DECL_CHAIN (decl));
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment