aboutsummaryrefslogtreecommitdiff
path: root/gcc/cp/decl.c
diff options
context:
space:
mode:
authorNathan Sidwell <nathan@acm.org>2020-09-29 12:03:27 -0700
committerNathan Sidwell <nathan@acm.org>2020-09-29 12:13:08 -0700
commit7cbfe0894dea4128805595dce3f23d0530b33a3c (patch)
tree8294bd15317839b583367f9b1f2cc367da535ed4 /gcc/cp/decl.c
parentdec881f85abbddc6e37630b6e61ce621cea6acd7 (diff)
downloadgcc-7cbfe0894dea4128805595dce3f23d0530b33a3c.zip
gcc-7cbfe0894dea4128805595dce3f23d0530b33a3c.tar.gz
gcc-7cbfe0894dea4128805595dce3f23d0530b33a3c.tar.bz2
c++: Hiddenness is a property of the symbol table
This patch moves the handling of decl-hiddenness entirely into the name lookup machinery, where it belongs. We need a few new flags, because pressing the existing OVL_HIDDEN_P into play for non-function decls doesn't work well. For a local binding we only need one marker, as there cannot be both a hidden implicit typedef and a hidden function. That's not true for namespace-scope, where they could both be hidden. The name-lookup machinery maintains the existing decl_hidden and co flags, and asserts have been sprinkled around to make sure they are consistent. The next series of patches will remove those old markers. (we'll need to keep one, as there are some special restrictions on redeclaring friend functions with in-class definitions or default args.) gcc/cp/ * cp-tree.h (ovl_insert): Change final parm to hidden-or-using indicator. * name-lookup.h (HIDDEN_TYPE_BINDING_P): New. (struct cxx_binding): Add type_is_hidden flag. * tree.c (ovl_insert): Change using_p parm to using_or_hidden, adjust. (ovl_skip_hidden): Assert we never see a naked hidden decl. * decl.c (xref_tag_1): Delete unhiding friend from here (moved to lookup_elaborated_type_1). * name-lookup.c (STAT_TYPE_HIDDEN_P, STAT_DECL_HIDDEN_P): New. (name_lookup::search_namespace_only): Check new hidden markers. (cxx_binding_make): Clear HIDDEN_TYPE_BINDING_P. (update_binding): Update new hidden markers. (lookup_name_1): Check HIDDEN_TYPE_BINDING_P and simplify friend ignoring. (lookup_elaborated_type_1): Use new hidden markers. Reveal the decl here.
Diffstat (limited to 'gcc/cp/decl.c')
-rw-r--r--gcc/cp/decl.c19
1 files changed, 3 insertions, 16 deletions
diff --git a/gcc/cp/decl.c b/gcc/cp/decl.c
index c00b996..617b96e 100644
--- a/gcc/cp/decl.c
+++ b/gcc/cp/decl.c
@@ -15089,22 +15089,9 @@ xref_tag_1 (enum tag_types tag_code, tree name,
return error_mark_node;
}
- if (how != TAG_how::HIDDEN_FRIEND && TYPE_HIDDEN_P (t))
- {
- /* This is no longer an invisible friend. Make it
- visible. */
- tree decl = TYPE_NAME (t);
-
- DECL_ANTICIPATED (decl) = false;
- DECL_FRIEND_P (decl) = false;
-
- if (TYPE_TEMPLATE_INFO (t))
- {
- tree tmpl = TYPE_TI_TEMPLATE (t);
- DECL_ANTICIPATED (tmpl) = false;
- DECL_FRIEND_P (tmpl) = false;
- }
- }
+ gcc_checking_assert (how == TAG_how::HIDDEN_FRIEND
+ || !(DECL_LANG_SPECIFIC (TYPE_NAME (t))
+ && DECL_ANTICIPATED (TYPE_NAME (t))));
}
return t;