From: Nathan Sidwell Date: Wed, 12 Jul 2017 17:29:11 +0000 (+0000) Subject: cp-tree.h (DECL_CONSTRUCTOR_P, [...]): Look at identifier flags. X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=3da3dcdb98a750533a9d863fce8e30c657d968af;p=gcc.git cp-tree.h (DECL_CONSTRUCTOR_P, [...]): Look at identifier flags. * cp-tree.h (DECL_CONSTRUCTOR_P, DECL_MAYBE_IN_CHARGE_CONSTRUCTOR, DECL_DESTRUCTOR_P, DECL_MAYBE_IN_CHARGE_DESTRCTOR): Look at identifier flags. * decl.c (grokfndecl): Set DECL_CXX_CONSTRUCTOR and DECL_CXX_DESTRUCTOR explicitly. * decl2.c (grokclassfn): Likewise. * friend.c (do_friend): Likewise. * method.c (make_thunk, make_alias_for, implicitly_declare_fn): Likewise. From-SVN: r250158 --- diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index bf77412d8be..178b2626098 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -1,3 +1,15 @@ +2017-07-12 Nathan Sidwell + + * cp-tree.h (DECL_CONSTRUCTOR_P, DECL_MAYBE_IN_CHARGE_CONSTRUCTOR, + DECL_DESTRUCTOR_P, DECL_MAYBE_IN_CHARGE_DESTRCTOR): Look at + identifier flags. + * decl.c (grokfndecl): Set DECL_CXX_CONSTRUCTOR and + DECL_CXX_DESTRUCTOR explicitly. + * decl2.c (grokclassfn): Likewise. + * friend.c (do_friend): Likewise. + * method.c (make_thunk, make_alias_for, + implicitly_declare_fn): Likewise. + 2017-07-11 Jason Merrill Core DR 393 diff --git a/gcc/cp/cp-tree.h b/gcc/cp/cp-tree.h index b58cfcecc6e..665ec034d0c 100644 --- a/gcc/cp/cp-tree.h +++ b/gcc/cp/cp-tree.h @@ -2706,7 +2706,7 @@ struct GTY(()) lang_decl { /* For FUNCTION_DECLs and TEMPLATE_DECLs: nonzero means that this function is a constructor. */ #define DECL_CONSTRUCTOR_P(NODE) \ - DECL_CXX_CONSTRUCTOR_P (STRIP_TEMPLATE (NODE)) + IDENTIFIER_CTOR_P (DECL_NAME (NODE)) /* Nonzero if NODE (a FUNCTION_DECL) is a constructor for a complete object. */ @@ -2722,8 +2722,7 @@ struct GTY(()) lang_decl { specialized in-charge constructor or the specialized not-in-charge constructor. */ #define DECL_MAYBE_IN_CHARGE_CONSTRUCTOR_P(NODE) \ - (DECL_DECLARES_FUNCTION_P (NODE) && DECL_CONSTRUCTOR_P (NODE) \ - && !DECL_CLONED_FUNCTION_P (NODE)) + (DECL_NAME (NODE) == ctor_identifier) /* Nonzero if NODE (a FUNCTION_DECL) is a copy constructor. */ #define DECL_COPY_CONSTRUCTOR_P(NODE) \ @@ -2736,14 +2735,13 @@ struct GTY(()) lang_decl { /* Nonzero if NODE (a FUNCTION_DECL or TEMPLATE_DECL) is a destructor. */ #define DECL_DESTRUCTOR_P(NODE) \ - DECL_CXX_DESTRUCTOR_P (STRIP_TEMPLATE (NODE)) + IDENTIFIER_DTOR_P (DECL_NAME (NODE)) /* Nonzero if NODE (a FUNCTION_DECL) is a destructor, but not the specialized in-charge constructor, in-charge deleting constructor, or the base destructor. */ #define DECL_MAYBE_IN_CHARGE_DESTRUCTOR_P(NODE) \ - (DECL_DECLARES_FUNCTION_P (NODE) && DECL_DESTRUCTOR_P (NODE) \ - && !DECL_CLONED_FUNCTION_P (NODE)) + (DECL_NAME (NODE) == dtor_identifier) /* Nonzero if NODE (a FUNCTION_DECL) is a destructor for a complete object. */ diff --git a/gcc/cp/decl.c b/gcc/cp/decl.c index b9b8794d29b..5b8e6a22b01 100644 --- a/gcc/cp/decl.c +++ b/gcc/cp/decl.c @@ -8513,11 +8513,11 @@ grokfndecl (tree ctype, case sfk_constructor: case sfk_copy_constructor: case sfk_move_constructor: - DECL_CONSTRUCTOR_P (decl) = 1; + DECL_CXX_CONSTRUCTOR_P (decl) = 1; DECL_NAME (decl) = ctor_identifier; break; case sfk_destructor: - DECL_DESTRUCTOR_P (decl) = 1; + DECL_CXX_DESTRUCTOR_P (decl) = 1; DECL_NAME (decl) = dtor_identifier; break; default: diff --git a/gcc/cp/decl2.c b/gcc/cp/decl2.c index 62a50acc93d..4fa4ad9740f 100644 --- a/gcc/cp/decl2.c +++ b/gcc/cp/decl2.c @@ -342,7 +342,7 @@ grokclassfn (tree ctype, tree function, enum overload_flags flags) DECL_CONTEXT (function) = ctype; if (flags == DTOR_FLAG) - DECL_DESTRUCTOR_P (function) = 1; + DECL_CXX_DESTRUCTOR_P (function) = 1; if (flags == DTOR_FLAG || DECL_CONSTRUCTOR_P (function)) maybe_retrofit_in_chrg (function); diff --git a/gcc/cp/friend.c b/gcc/cp/friend.c index a3c2ed09472..ef93bfe39ec 100644 --- a/gcc/cp/friend.c +++ b/gcc/cp/friend.c @@ -529,7 +529,7 @@ do_friend (tree ctype, tree declarator, tree decl, /* A method friend. */ if (flags == NO_SPECIAL && declarator == cname) - DECL_CONSTRUCTOR_P (decl) = 1; + DECL_CXX_CONSTRUCTOR_P (decl) = 1; grokclassfn (ctype, decl, flags); diff --git a/gcc/cp/method.c b/gcc/cp/method.c index 0646b08e577..0a4a9540622 100644 --- a/gcc/cp/method.c +++ b/gcc/cp/method.c @@ -137,8 +137,8 @@ make_thunk (tree function, bool this_adjusting, DECL_SAVED_FUNCTION_DATA (thunk) = NULL; /* The thunk itself is not a constructor or destructor, even if the thing it is thunking to is. */ - DECL_DESTRUCTOR_P (thunk) = 0; - DECL_CONSTRUCTOR_P (thunk) = 0; + DECL_CXX_DESTRUCTOR_P (thunk) = 0; + DECL_CXX_CONSTRUCTOR_P (thunk) = 0; DECL_EXTERNAL (thunk) = 1; DECL_ARTIFICIAL (thunk) = 1; /* The THUNK is not a pending inline, even if the FUNCTION is. */ @@ -223,8 +223,8 @@ make_alias_for (tree target, tree newid) if (TREE_CODE (alias) == FUNCTION_DECL) { DECL_SAVED_FUNCTION_DATA (alias) = NULL; - DECL_DESTRUCTOR_P (alias) = 0; - DECL_CONSTRUCTOR_P (alias) = 0; + DECL_CXX_DESTRUCTOR_P (alias) = 0; + DECL_CXX_CONSTRUCTOR_P (alias) = 0; DECL_PENDING_INLINE_P (alias) = 0; DECL_DECLARED_INLINE_P (alias) = 0; DECL_INITIAL (alias) = error_mark_node; @@ -2058,9 +2058,9 @@ implicitly_declare_fn (special_function_kind kind, tree type, /* Assignment operator. */ SET_OVERLOADED_OPERATOR_CODE (fn, NOP_EXPR); else if (IDENTIFIER_CTOR_P (name)) - DECL_CONSTRUCTOR_P (fn) = true; + DECL_CXX_CONSTRUCTOR_P (fn) = true; else - DECL_DESTRUCTOR_P (fn) = true; + DECL_CXX_DESTRUCTOR_P (fn) = true; SET_DECL_ALIGN (fn, MINIMUM_METHOD_BOUNDARY);