From 31a714f6d8619a542fe7a43ced8e205e47d03228 Mon Sep 17 00:00:00 2001 From: Mark Mitchell Date: Fri, 29 Dec 2000 09:20:46 +0000 Subject: [PATCH] class.c (pushclass): Remove #if 0'd code. * class.c (pushclass): Remove #if 0'd code. * cp-tree.h (overload_template_name): Remove. * decl.c (store_bindings): Simplify. (pop_from_top_level): Likewise. * pt.c (overload_template_name): Remove. (instantiate_decl): Don't call push_to_top_level if it's not needed. From-SVN: r38530 --- gcc/cp/ChangeLog | 10 ++++++++++ gcc/cp/class.c | 5 ----- gcc/cp/cp-tree.h | 1 - gcc/cp/decl.c | 28 +++++++++++----------------- gcc/cp/pt.c | 26 ++++++-------------------- 5 files changed, 27 insertions(+), 43 deletions(-) diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index 2000fc225a6..d35161ab1f7 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -1,3 +1,13 @@ +2000-12-29 Mark Mitchell + + * class.c (pushclass): Remove #if 0'd code. + * cp-tree.h (overload_template_name): Remove. + * decl.c (store_bindings): Simplify. + (pop_from_top_level): Likewise. + * pt.c (overload_template_name): Remove. + (instantiate_decl): Don't call push_to_top_level if it's not + needed. + 2000-12-28 Mark Mitchell * pt.c (register_local_specialization): Don't return a value. diff --git a/gcc/cp/class.c b/gcc/cp/class.c index 4e6babd14ef..db4b480538c 100644 --- a/gcc/cp/class.c +++ b/gcc/cp/class.c @@ -5603,11 +5603,6 @@ pushclass (type, modify) pushlevel_class (); -#if 0 - if (CLASSTYPE_TEMPLATE_INFO (type)) - overload_template_name (type); -#endif - if (modify) { if (type != previous_class_type || current_class_depth > 1) diff --git a/gcc/cp/cp-tree.h b/gcc/cp/cp-tree.h index fb5c753c048..10afa3203f6 100644 --- a/gcc/cp/cp-tree.h +++ b/gcc/cp/cp-tree.h @@ -4186,7 +4186,6 @@ extern tree lookup_template_function PARAMS ((tree, tree)); extern int uses_template_parms PARAMS ((tree)); extern tree instantiate_class_template PARAMS ((tree)); extern tree instantiate_template PARAMS ((tree, tree)); -extern void overload_template_name PARAMS ((tree)); extern int fn_type_unification PARAMS ((tree, tree, tree, tree, tree, unification_kind_t, int)); extern tree tinst_for_decl PARAMS ((void)); extern void mark_decl_instantiated PARAMS ((tree, int)); diff --git a/gcc/cp/decl.c b/gcc/cp/decl.c index ab058426bd7..a07f6a99551 100644 --- a/gcc/cp/decl.c +++ b/gcc/cp/decl.c @@ -2447,18 +2447,14 @@ store_bindings (names, old_bindings) if (TREE_VEC_ELT (t1, 0) == id) goto skip_it; + my_friendly_assert (TREE_CODE (id) == IDENTIFIER_NODE, 135); binding = make_tree_vec (4); - - if (id) - { - my_friendly_assert (TREE_CODE (id) == IDENTIFIER_NODE, 135); - TREE_VEC_ELT (binding, 0) = id; - TREE_VEC_ELT (binding, 1) = REAL_IDENTIFIER_TYPE_VALUE (id); - TREE_VEC_ELT (binding, 2) = IDENTIFIER_BINDING (id); - TREE_VEC_ELT (binding, 3) = IDENTIFIER_CLASS_VALUE (id); - IDENTIFIER_BINDING (id) = NULL_TREE; - IDENTIFIER_CLASS_VALUE (id) = NULL_TREE; - } + TREE_VEC_ELT (binding, 0) = id; + TREE_VEC_ELT (binding, 1) = REAL_IDENTIFIER_TYPE_VALUE (id); + TREE_VEC_ELT (binding, 2) = IDENTIFIER_BINDING (id); + TREE_VEC_ELT (binding, 3) = IDENTIFIER_CLASS_VALUE (id); + IDENTIFIER_BINDING (id) = NULL_TREE; + IDENTIFIER_CLASS_VALUE (id) = NULL_TREE; TREE_CHAIN (binding) = old_bindings; old_bindings = binding; skip_it: @@ -2552,12 +2548,10 @@ pop_from_top_level () for (t = s->old_bindings; t; t = TREE_CHAIN (t)) { tree id = TREE_VEC_ELT (t, 0); - if (id) - { - SET_IDENTIFIER_TYPE_VALUE (id, TREE_VEC_ELT (t, 1)); - IDENTIFIER_BINDING (id) = TREE_VEC_ELT (t, 2); - IDENTIFIER_CLASS_VALUE (id) = TREE_VEC_ELT (t, 3); - } + + SET_IDENTIFIER_TYPE_VALUE (id, TREE_VEC_ELT (t, 1)); + IDENTIFIER_BINDING (id) = TREE_VEC_ELT (t, 2); + IDENTIFIER_CLASS_VALUE (id) = TREE_VEC_ELT (t, 3); } /* If we were in the middle of compiling a function, restore our diff --git a/gcc/cp/pt.c b/gcc/cp/pt.c index cc18eef4ac9..9b049854644 100644 --- a/gcc/cp/pt.c +++ b/gcc/cp/pt.c @@ -7558,24 +7558,6 @@ instantiate_template (tmpl, targ_ptr) return fndecl; } -/* Push the name of the class template into the scope of the instantiation. */ - -void -overload_template_name (type) - tree type; -{ - tree id = DECL_NAME (CLASSTYPE_TI_TEMPLATE (type)); - tree decl; - - if (IDENTIFIER_CLASS_VALUE (id) - && TREE_TYPE (IDENTIFIER_CLASS_VALUE (id)) == type) - return; - - decl = build_decl (TYPE_DECL, id, type); - DECL_ARTIFICIAL (decl) = 1; - pushdecl_class_level (decl); -} - /* The FN is a TEMPLATE_DECL for a function. The ARGS are the arguments that are being used when calling it. TARGS is a vector into which the deduced template arguments are placed. @@ -9621,6 +9603,7 @@ instantiate_decl (d, defer_ok) tree gen_tmpl; int pattern_defined; int line = lineno; + int need_push; const char *file = input_filename; /* This function should only be used to instantiate templates for @@ -9776,7 +9759,9 @@ instantiate_decl (d, defer_ok) goto out; } - push_to_top_level (); + need_push = !global_bindings_p (); + if (need_push) + push_to_top_level (); /* We're now committed to instantiating this template. Mark it as instantiated so that recursive calls to instantiate_decl do not @@ -9840,7 +9825,8 @@ instantiate_decl (d, defer_ok) /* We're not deferring instantiation any more. */ TI_PENDING_TEMPLATE_FLAG (DECL_TEMPLATE_INFO (d)) = 0; - pop_from_top_level (); + if (need_push) + pop_from_top_level (); out: lineno = line; -- 2.30.2