summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorpaolo <paolo@138bc75d-0d04-0410-961f-82ee72b054a4>2018-05-15 16:03:56 +0000
committerpaolo <paolo@138bc75d-0d04-0410-961f-82ee72b054a4>2018-05-15 16:03:56 +0000
commitc6e04fcae681df5373fb5630458bca35fd94dd89 (patch)
treede8826a8ed6f3eb667225fe3f17a498d31361127
parentcae1d5ed994f408df39390edfe861de0203450fe (diff)
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. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@260264 138bc75d-0d04-0410-961f-82ee72b054a4
-rw-r--r--gcc/cp/ChangeLog12
-rw-r--r--gcc/cp/cp-tree.h9
-rw-r--r--gcc/cp/decl.c4
-rw-r--r--gcc/cp/decl2.c3
-rw-r--r--gcc/cp/mangle.c3
-rw-r--r--gcc/cp/method.c3
-rw-r--r--gcc/cp/optimize.c6
-rw-r--r--gcc/cp/repo.c3
-rw-r--r--gcc/cp/tree.c3
9 files changed, 27 insertions, 19 deletions
diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog
index 27ff8f353b98..322c5b9ed99c 100644
--- a/gcc/cp/ChangeLog
+++ b/gcc/cp/ChangeLog
@@ -1,3 +1,15 @@
+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>
Handle TYPE_HAS_LATE_RETURN_TYPE like ref-qualifier and eh spec.
diff --git a/gcc/cp/cp-tree.h b/gcc/cp/cp-tree.h
index 398f7adc0511..9a2eb3be4d1a 100644
--- a/gcc/cp/cp-tree.h
+++ b/gcc/cp/cp-tree.h
@@ -2783,6 +2783,12 @@ struct GTY(()) lang_decl {
#define DECL_DELETING_DESTRUCTOR_P(NODE) \
(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
destructor. */
#define DECL_CLONED_FUNCTION_P(NODE) (!!decl_cloned_function_p (NODE, true))
@@ -2800,8 +2806,7 @@ struct GTY(()) lang_decl {
*/
#define FOR_EACH_CLONE(CLONE, FN) \
if (!(TREE_CODE (FN) == FUNCTION_DECL \
- && (DECL_MAYBE_IN_CHARGE_CONSTRUCTOR_P (FN) \
- || DECL_MAYBE_IN_CHARGE_DESTRUCTOR_P (FN))))\
+ && DECL_MAYBE_IN_CHARGE_CDTOR_P (FN))) \
; \
else \
for (CLONE = DECL_CHAIN (FN); \
diff --git a/gcc/cp/decl.c b/gcc/cp/decl.c
index 92639a886a17..10e3079beed5 100644
--- a/gcc/cp/decl.c
+++ b/gcc/cp/decl.c
@@ -11721,9 +11721,7 @@ grokdeclarator (const cp_declarator *declarator,
{
if (!current_function_decl)
DECL_CONTEXT (decl) = FROB_CONTEXT (current_namespace);
- else if (DECL_MAYBE_IN_CHARGE_CONSTRUCTOR_P (current_function_decl)
- || (DECL_MAYBE_IN_CHARGE_DESTRUCTOR_P
- (current_function_decl)))
+ else if (DECL_MAYBE_IN_CHARGE_CDTOR_P (current_function_decl))
/* The TYPE_DECL is "abstract" because there will be
clones of this constructor/destructor, and there will
be copies of this TYPE_DECL generated in those
diff --git a/gcc/cp/decl2.c b/gcc/cp/decl2.c
index 14a3cddacb88..126356d5de49 100644
--- a/gcc/cp/decl2.c
+++ b/gcc/cp/decl2.c
@@ -1933,8 +1933,7 @@ vague_linkage_p (tree decl)
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
maybe_clone_body we haven't yet copied the linkage to the clones. */
- if ((DECL_MAYBE_IN_CHARGE_DESTRUCTOR_P (decl)
- || DECL_MAYBE_IN_CHARGE_CONSTRUCTOR_P (decl))
+ if (DECL_MAYBE_IN_CHARGE_CDTOR_P (decl)
&& !DECL_ABSTRACT_P (decl)
&& DECL_CHAIN (decl)
&& DECL_CLONED_FUNCTION_P (DECL_CHAIN (decl)))
diff --git a/gcc/cp/mangle.c b/gcc/cp/mangle.c
index 387990b76a35..6a7df804cafa 100644
--- a/gcc/cp/mangle.c
+++ b/gcc/cp/mangle.c
@@ -3862,8 +3862,7 @@ mangle_decl (const tree decl)
if (id != DECL_NAME (decl)
/* Don't do this for a fake symbol we aren't going to emit anyway. */
&& TREE_CODE (decl) != TYPE_DECL
- && !DECL_MAYBE_IN_CHARGE_CONSTRUCTOR_P (decl)
- && !DECL_MAYBE_IN_CHARGE_DESTRUCTOR_P (decl))
+ && !DECL_MAYBE_IN_CHARGE_CDTOR_P (decl))
{
int save_ver = flag_abi_version;
tree id2 = NULL_TREE;
diff --git a/gcc/cp/method.c b/gcc/cp/method.c
index e9add9addc41..ef0df7eb8d94 100644
--- a/gcc/cp/method.c
+++ b/gcc/cp/method.c
@@ -2422,8 +2422,7 @@ lazily_declare_fn (special_function_kind sfk, tree type)
fixup_type_variants (type);
maybe_add_class_template_decl_list (type, fn, /*friend_p=*/0);
- if (DECL_MAYBE_IN_CHARGE_CONSTRUCTOR_P (fn)
- || DECL_MAYBE_IN_CHARGE_DESTRUCTOR_P (fn))
+ if (DECL_MAYBE_IN_CHARGE_CDTOR_P (fn))
/* Create appropriate clones. */
clone_function_decl (fn, /*update_methods=*/true);
diff --git a/gcc/cp/optimize.c b/gcc/cp/optimize.c
index fdb1650939e9..0e9b84ed8a4d 100644
--- a/gcc/cp/optimize.c
+++ b/gcc/cp/optimize.c
@@ -194,8 +194,7 @@ can_alias_cdtor (tree fn)
/* ??? Why not use aliases with -frepo? */
if (flag_use_repository)
return false;
- gcc_assert (DECL_MAYBE_IN_CHARGE_CONSTRUCTOR_P (fn)
- || DECL_MAYBE_IN_CHARGE_DESTRUCTOR_P (fn));
+ gcc_assert (DECL_MAYBE_IN_CHARGE_CDTOR_P (fn));
/* Don't use aliases for weak/linkonce definitions unless we can put both
symbols in the same COMDAT group. */
return (DECL_INTERFACE_KNOWN (fn)
@@ -440,8 +439,7 @@ maybe_clone_body (tree fn)
bool need_alias = false;
/* We only clone constructors and destructors. */
- if (!DECL_MAYBE_IN_CHARGE_CONSTRUCTOR_P (fn)
- && !DECL_MAYBE_IN_CHARGE_DESTRUCTOR_P (fn))
+ if (!DECL_MAYBE_IN_CHARGE_CDTOR_P (fn))
return 0;
populate_clone_array (fn, fns);
diff --git a/gcc/cp/repo.c b/gcc/cp/repo.c
index 361f6176a86a..6af8f19a8b89 100644
--- a/gcc/cp/repo.c
+++ b/gcc/cp/repo.c
@@ -330,8 +330,7 @@ repo_emit_p (tree decl)
/* For constructors and destructors, the repository contains
information about the clones -- not the original function --
because only the clones are emitted in the object file. */
- if (DECL_MAYBE_IN_CHARGE_CONSTRUCTOR_P (decl)
- || DECL_MAYBE_IN_CHARGE_DESTRUCTOR_P (decl))
+ if (DECL_MAYBE_IN_CHARGE_CDTOR_P (decl))
{
int emit_p = 0;
tree clone;
diff --git a/gcc/cp/tree.c b/gcc/cp/tree.c
index 463a06d83707..ecb88df23b91 100644
--- a/gcc/cp/tree.c
+++ b/gcc/cp/tree.c
@@ -5012,8 +5012,7 @@ decl_linkage (tree decl)
/* maybe_thunk_body clears TREE_PUBLIC on the maybe-in-charge 'tor variants,
check one of the "clones" for the real linkage. */
- if ((DECL_MAYBE_IN_CHARGE_DESTRUCTOR_P (decl)
- || DECL_MAYBE_IN_CHARGE_CONSTRUCTOR_P (decl))
+ if (DECL_MAYBE_IN_CHARGE_CDTOR_P (decl)
&& DECL_CHAIN (decl)
&& DECL_CLONED_FUNCTION_P (DECL_CHAIN (decl)))
return decl_linkage (DECL_CHAIN (decl));