diff options
author | Jason Merrill <jason@redhat.com> | 2019-10-02 15:26:47 -0400 |
---|---|---|
committer | Jason Merrill <jason@gcc.gnu.org> | 2019-10-02 15:26:47 -0400 |
commit | c89844e5d30a5235960a2c627abc9369306fda61 (patch) | |
tree | 49f593d8b44f2a0038aa8a77148c902c63381b29 /gcc/cp/pt.c | |
parent | d61bff850d13ff103de3c2fb13d5e371996e1a3c (diff) | |
download | gcc-c89844e5d30a5235960a2c627abc9369306fda61.tar.gz |
Add some hash_map_safe_* functions like vec_safe_*.
gcc/
* hash-map.h (default_hash_map_size): New variable.
(create_ggc): Use it as default argument.
(hash_map_maybe_create, hash_map_safe_get)
(hash_map_safe_get_or_insert, hash_map_safe_put): New fns.
gcc/cp/
* constexpr.c (maybe_initialize_fundef_copies_table): Remove.
(get_fundef_copy): Use hash_map_safe_get_or_insert.
* cp-objcp-common.c (cp_get_debug_type): Use hash_map_safe_*.
* decl.c (store_decomp_type): Remove.
(cp_finish_decomp): Use hash_map_safe_put.
* init.c (get_nsdmi): Use hash_map_safe_*.
* pt.c (store_defaulted_ttp, lookup_defaulted_ttp): Remove.
(add_defaults_to_ttp): Use hash_map_safe_*.
From-SVN: r276484
Diffstat (limited to 'gcc/cp/pt.c')
-rw-r--r-- | gcc/cp/pt.c | 21 |
1 files changed, 3 insertions, 18 deletions
diff --git a/gcc/cp/pt.c b/gcc/cp/pt.c index 44b36183304..67b3b63cdfe 100644 --- a/gcc/cp/pt.c +++ b/gcc/cp/pt.c @@ -7357,21 +7357,6 @@ coerce_template_args_for_ttp (tree templ, tree arglist, /* A cache of template template parameters with match-all default arguments. */ static GTY((deletable)) hash_map<tree,tree> *defaulted_ttp_cache; -static void -store_defaulted_ttp (tree v, tree t) -{ - if (!defaulted_ttp_cache) - defaulted_ttp_cache = hash_map<tree,tree>::create_ggc (13); - defaulted_ttp_cache->put (v, t); -} -static tree -lookup_defaulted_ttp (tree v) -{ - if (defaulted_ttp_cache) - if (tree *p = defaulted_ttp_cache->get (v)) - return *p; - return NULL_TREE; -} /* T is a bound template template-parameter. Copy its arguments into default arguments of the template template-parameter's template parameters. */ @@ -7379,8 +7364,8 @@ lookup_defaulted_ttp (tree v) static tree add_defaults_to_ttp (tree otmpl) { - if (tree c = lookup_defaulted_ttp (otmpl)) - return c; + if (tree *c = hash_map_safe_get (defaulted_ttp_cache, otmpl)) + return *c; tree ntmpl = copy_node (otmpl); @@ -7410,7 +7395,7 @@ add_defaults_to_ttp (tree otmpl) } } - store_defaulted_ttp (otmpl, ntmpl); + hash_map_safe_put<hm_ggc> (defaulted_ttp_cache, otmpl, ntmpl); return ntmpl; } |