diff options
author | Nathan Sidwell <nathan@acm.org> | 2020-10-02 12:21:08 -0700 |
---|---|---|
committer | Nathan Sidwell <nathan@acm.org> | 2020-10-02 12:21:08 -0700 |
commit | 679dbc9dcec0d1240951442947199ba155f494b6 (patch) | |
tree | 32a0b84c34b0d8598cd12f7b34388d598780f933 /gcc/cp/decl.c | |
parent | 7ee1c0413e251ff0b6a6d526209ef038b9835320 (diff) | |
download | gcc-679dbc9dcec0d1240951442947199ba155f494b6.zip gcc-679dbc9dcec0d1240951442947199ba155f494b6.tar.gz gcc-679dbc9dcec0d1240951442947199ba155f494b6.tar.bz2 |
c++: Kill DECL_ANTICIPATED
Here's the patch to remove DECL_ANTICIPATED, and with it hiddenness is
managed entirely in the symbol table. Sadly I couldn't get rid of the
actual field without more investigation -- it's repurposed for
OMP_PRIVATIZED_MEMBER. It looks like a the VAR-related flags in
lang_decl_base are not completely orthogonal, so perhaps some can be
turned into an enumeration or something. But that's more than I want
to do right now.
DECL_FRIEND_P Is still slightly suspect as it appears to mean more
than just in-class definition. However, I'm leaving that for now.
gcc/cp/
* cp-tree.h (lang_decl_base): anticipated_p is not used for
anticipatedness.
(DECL_ANTICIPATED): Delete.
* decl.c (duplicate_decls): Delete DECL_ANTICIPATED_management,
use was_hidden.
(cxx_builtin_function): Drop DECL_ANTICIPATED setting.
(xref_tag_1): Drop DECL_ANTICIPATED assert.
* name-lookup.c (name_lookup::adl_class_only): Drop
DECL_ANTICIPATED check.
(name_lookup::search_adl): Always dedup.
(anticipated_builtin_p): Reimplement.
(do_pushdecl): Drop DECL_ANTICIPATED asserts & update.
(lookup_elaborated_type_1): Drop DECL_ANTICIPATED update.
(do_pushtag): Drop DECL_ANTICIPATED setting.
* pt.c (push_template_decl): Likewise.
(tsubst_friend_class): Likewise.
libcc1/
* libcp1plugin.cc (libcp1plugin.cc): Drop DECL_ANTICIPATED test.
Diffstat (limited to 'gcc/cp/decl.c')
-rw-r--r-- | gcc/cp/decl.c | 31 |
1 files changed, 8 insertions, 23 deletions
diff --git a/gcc/cp/decl.c b/gcc/cp/decl.c index 6b306ee..f333a36 100644 --- a/gcc/cp/decl.c +++ b/gcc/cp/decl.c @@ -1444,7 +1444,7 @@ tree duplicate_decls (tree newdecl, tree olddecl, bool hiding, bool was_hidden) { unsigned olddecl_uid = DECL_UID (olddecl); - int olddecl_friend = 0, types_match = 0, hidden_friend = 0; + int olddecl_friend = 0, types_match = 0; int olddecl_hidden_friend = 0; int new_defines_function = 0; tree new_template_info; @@ -1473,7 +1473,7 @@ duplicate_decls (tree newdecl, tree olddecl, bool hiding, bool was_hidden) { /* Avoid warnings redeclaring built-ins which have not been explicitly declared. */ - if (DECL_ANTICIPATED (olddecl)) + if (was_hidden) { if (TREE_PUBLIC (newdecl) && CP_DECL_CONTEXT (newdecl) == global_namespace) @@ -1645,7 +1645,7 @@ duplicate_decls (tree newdecl, tree olddecl, bool hiding, bool was_hidden) /* If a function is explicitly declared "throw ()", propagate that to the corresponding builtin. */ if (DECL_BUILT_IN_CLASS (olddecl) == BUILT_IN_NORMAL - && DECL_ANTICIPATED (olddecl) + && was_hidden && TREE_NOTHROW (newdecl) && !TREE_NOTHROW (olddecl)) { @@ -2139,9 +2139,6 @@ duplicate_decls (tree newdecl, tree olddecl, bool hiding, bool was_hidden) { olddecl_friend = DECL_FRIEND_P (STRIP_TEMPLATE (olddecl)); olddecl_hidden_friend = olddecl_friend && was_hidden; - hidden_friend = olddecl_hidden_friend && hiding; - if (!hidden_friend) - DECL_ANTICIPATED (olddecl) = false; } if (TREE_CODE (newdecl) == TEMPLATE_DECL) @@ -2890,8 +2887,6 @@ duplicate_decls (tree newdecl, tree olddecl, bool hiding, bool was_hidden) DECL_UID (olddecl) = olddecl_uid; if (olddecl_friend) DECL_FRIEND_P (olddecl) = true; - if (hidden_friend) - DECL_ANTICIPATED (olddecl) = true; /* NEWDECL contains the merged attribute lists. Update OLDDECL to be the same. */ @@ -4690,21 +4685,15 @@ cxx_builtin_function (tree decl) const char *name = IDENTIFIER_POINTER (id); bool hiding = false; if (name[0] != '_' || name[1] != '_') - { - /* In the user's namespace, it must be declared before use. */ - DECL_ANTICIPATED (decl) = 1; - hiding = true; - } + /* In the user's namespace, it must be declared before use. */ + hiding = true; else if (IDENTIFIER_LENGTH (id) > strlen ("___chk") && 0 != strncmp (name + 2, "builtin_", strlen ("builtin_")) && 0 == memcmp (name + IDENTIFIER_LENGTH (id) - strlen ("_chk"), "_chk", strlen ("_chk") + 1)) - { - /* Treat __*_chk fortification functions as anticipated as well, - unless they are __builtin_*_chk. */ - DECL_ANTICIPATED (decl) = 1; - hiding = true; - } + /* Treat __*_chk fortification functions as anticipated as well, + unless they are __builtin_*_chk. */ + hiding = true; /* All builtins that don't begin with an '_' should additionally go in the 'std' namespace. */ @@ -15063,10 +15052,6 @@ xref_tag_1 (enum tag_types tag_code, tree name, inform (location_of (t), "previous declaration %qD", t); return error_mark_node; } - - gcc_checking_assert (how == TAG_how::HIDDEN_FRIEND - || !(DECL_LANG_SPECIFIC (TYPE_NAME (t)) - && DECL_ANTICIPATED (TYPE_NAME (t)))); } return t; |