OSDN Git Service

* class.c (pushclass): Remove #if 0'd code.
authormmitchel <mmitchel@138bc75d-0d04-0410-961f-82ee72b054a4>
Fri, 29 Dec 2000 09:20:46 +0000 (09:20 +0000)
committermmitchel <mmitchel@138bc75d-0d04-0410-961f-82ee72b054a4>
Fri, 29 Dec 2000 09:20:46 +0000 (09:20 +0000)
* 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.

git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@38530 138bc75d-0d04-0410-961f-82ee72b054a4

gcc/cp/ChangeLog
gcc/cp/class.c
gcc/cp/cp-tree.h
gcc/cp/decl.c
gcc/cp/pt.c

index 2000fc2..d35161a 100644 (file)
@@ -1,3 +1,13 @@
+2000-12-29  Mark Mitchell  <mark@codesourcery.com>
+
+       * 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  <mark@codesourcery.com>
 
        * pt.c (register_local_specialization): Don't return a value.
index 4e6babd..db4b480 100644 (file)
@@ -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)
index fb5c753..10afa32 100644 (file)
@@ -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));
index ab05842..a07f6a9 100644 (file)
@@ -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
index cc18eef..9b04985 100644 (file)
@@ -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;