aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJason Merrill <jason@redhat.com>2023-03-16 17:13:57 -0400
committerJason Merrill <jason@redhat.com>2023-04-26 17:16:22 -0400
commit9b40ca2569d71e54d7dbbdbfd00d733770576f6f (patch)
treeee5b5f9a8bb52f8617494f9fddf3d19bccbcab28
parentd60cbbfaa9a3ad3bd1f613be95add939c16fc9a1 (diff)
downloadgcc-9b40ca2569d71e54d7dbbdbfd00d733770576f6f.zip
gcc-9b40ca2569d71e54d7dbbdbfd00d733770576f6f.tar.gz
gcc-9b40ca2569d71e54d7dbbdbfd00d733770576f6f.tar.bz2
c++: remove nsdmi_inst hashtable
It occurred to me that we have a perfectly good DECL_INITIAL field to put the instantiated DMI into, we don't need a separate hash table. gcc/cp/ChangeLog: * init.cc (nsdmi_inst): Remove. (maybe_instantiate_nsdmi_init): Use DECL_INITIAL instead.
-rw-r--r--gcc/cp/init.cc10
1 files changed, 4 insertions, 6 deletions
diff --git a/gcc/cp/init.cc b/gcc/cp/init.cc
index 9571d18..1dd24e3 100644
--- a/gcc/cp/init.cc
+++ b/gcc/cp/init.cc
@@ -564,21 +564,19 @@ perform_target_ctor (tree init)
/* Instantiate the default member initializer of MEMBER, if needed.
Only get_nsdmi should use the return value of this function. */
-static GTY((cache)) decl_tree_cache_map *nsdmi_inst;
-
tree
maybe_instantiate_nsdmi_init (tree member, tsubst_flags_t complain)
{
tree init = DECL_INITIAL (member);
- if (init && DECL_LANG_SPECIFIC (member) && DECL_TEMPLATE_INFO (member))
+
+ /* tsubst_decl uses void_node to indicate an uninstantiated DMI. */
+ if (init == void_node)
{
init = DECL_INITIAL (DECL_TI_TEMPLATE (member));
location_t expr_loc
= cp_expr_loc_or_loc (init, DECL_SOURCE_LOCATION (member));
if (TREE_CODE (init) == DEFERRED_PARSE)
/* Unparsed. */;
- else if (tree *slot = hash_map_safe_get (nsdmi_inst, member))
- init = *slot;
/* Check recursive instantiation. */
else if (DECL_INSTANTIATING_NSDMI_P (member))
{
@@ -639,7 +637,7 @@ maybe_instantiate_nsdmi_init (tree member, tsubst_flags_t complain)
DECL_INSTANTIATING_NSDMI_P (member) = 0;
if (init != error_mark_node)
- hash_map_safe_put<hm_ggc> (nsdmi_inst, member, init);
+ DECL_INITIAL (member) = init;
current_function_decl = cfd;
current_binding_level = cbl;