]> gcc.gnu.org Git - gcc.git/commitdiff
cp-tree.h (popclass): Change declaration.
authorMark Mitchell <mmitchel@gcc.gnu.org>
Wed, 14 Apr 1999 13:20:19 +0000 (13:20 +0000)
committerMark Mitchell <mmitchel@gcc.gnu.org>
Wed, 14 Apr 1999 13:20:19 +0000 (13:20 +0000)
* cp-tree.h (popclass): Change declaration.
(pop_nested_class): Likewise.
(poplevel_class): Remove declaration.
* call.c (convert_default_argument): Pass no arguments to
popclass.
* class.c (finish_struct_1): Likewise.
(finish_struct): Likewise.
(popclass): Remove argument.  Simplify code accordingly.
(pop_nested_class): Likewise.
* decl.c (poplevel_class): Declare it here, and make it static.
(poplevel): Handle class scopes.
(pop_level_class): Don't take an rgument.  Simplify.
(pop_everything): Pass no arguments to pop_nested_class.
(cp_finish_decl): Pass no arguments to popclass.
(grokdeclarator): Pass no arguments to pop_nested_class.
(finish_function): Likewise.
* decl2.c (grokfield): Likewise.
(pop_scope): Pass no arguments to popclass.
* lex.c (do_pending_defargs): Pass no arguments to pop_nested_class.
* pt.c (instantiate_class_template): Move call to pushclass, and
document.  Pass no arguments to popclass.
(regenerate_decl_from_template): Likewise.

From-SVN: r26454

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

index eeb1465345505fdf0d21e881c22d732ff3c8ba1a..bb4e6b71265492cb53a1b1036b2dd6f28cc1aa24 100644 (file)
@@ -1,3 +1,28 @@
+1999-04-14  Mark Mitchell  <mark@codesourcery.com>
+
+       * cp-tree.h (popclass): Change declaration.
+       (pop_nested_class): Likewise.
+       (poplevel_class): Remove declaration.
+       * call.c (convert_default_argument): Pass no arguments to
+       popclass.
+       * class.c (finish_struct_1): Likewise.
+       (finish_struct): Likewise.
+       (popclass): Remove argument.  Simplify code accordingly.
+       (pop_nested_class): Likewise.
+       * decl.c (poplevel_class): Declare it here, and make it static.
+       (poplevel): Handle class scopes.
+       (pop_level_class): Don't take an rgument.  Simplify.
+       (pop_everything): Pass no arguments to pop_nested_class.
+       (cp_finish_decl): Pass no arguments to popclass.
+       (grokdeclarator): Pass no arguments to pop_nested_class.
+       (finish_function): Likewise.
+       * decl2.c (grokfield): Likewise.
+       (pop_scope): Pass no arguments to popclass.
+       * lex.c (do_pending_defargs): Pass no arguments to pop_nested_class.
+       * pt.c (instantiate_class_template): Move call to pushclass, and
+       document.  Pass no arguments to popclass.
+       (regenerate_decl_from_template): Likewise.
+       
 1999-04-14  Jason Merrill  <jason@yorick.cygnus.com>
 
        * typeck.c (build_unary_op): Handle taking the address of a unique
@@ -9135,6 +9160,26 @@ Sat Sep 27 16:22:48 1997  Jason Merrill  <jason@yorick.cygnus.com>
        (notype_qualified_id): Don't add template declarators here.
 
 Sat Sep 27 16:21:58 1997  Mark Mitchell  <mmitchell@usa.net>
+<<<<<<< ChangeLog
+<<<<<<< ChangeLog
+
+        * call.c (add_template_candidate): Add explicit_targs parameter.
+        (build_scoped_method_call): Use it.
+        (build_overload_call_real): Likewise.
+        (build_user_type_conversion_1): Likewise.
+        (build_new_function_call): Likewise.
+        (build_object_call): Likewise.
+        (build_new_op): Likewise.
+        (build_new_method_call): Likewise.
+        (build_new_function_call): Handle TEMPLATE_ID_EXPR.
+        (build_new_method_call): Likewise.
+
+        * class.c (finish_struct_methods): Add specialization pass to
+        determine which methods were specializing which other methods.
+        (instantiate_type): Handle TEMPLATE_ID_EXPR.
+=======
+=======
+>>>>>>> 1.996
 
        * call.c (add_template_candidate): Add explicit_targs parameter.
        (build_scoped_method_call): Use it.
@@ -9179,11 +9224,31 @@ Sat Sep 27 16:21:58 1997  Mark Mitchell  <mmitchell@usa.net>
 
        * friend.c (do_friend): Don't call pushdecl for template
        instantiations.
-
+<<<<<<< ChangeLog
+>>>>>>> 1.988
+=======
+>>>>>>> 1.996
+
+<<<<<<< ChangeLog
+<<<<<<< ChangeLog
+        * init.c (build_member_call): Handle TEMPLATE_ID_EXPR.
+
+        * lang-options.h: Add -fname-mangling-version, -fguiding-decls, 
+=======
+=======
+>>>>>>> 1.996
        * init.c (build_member_call): Handle TEMPLATE_ID_EXPR.
 
        * lang-options.h: Add -fname-mangling-version, -fguiding-decls,
        and -fno-guiding-decls.
+<<<<<<< ChangeLog
+<<<<<<< ChangeLog
+
+        * lex.c (identifier_type): Return PFUNCNAME for template function
+        names.
+=======
+=======
+>>>>>>> 1.996
 
        * lex.c (identifier_type): Return PFUNCNAME for template function
        names.
index fb3df65ae9059c62af889bcc3c96e71065abf1c9..7a20421e2b23ce686e33f90aec247ae4510ad9ab 100644 (file)
@@ -3196,7 +3196,7 @@ convert_default_arg (type, arg, fn)
       arg = tsubst_expr (arg, DECL_TI_ARGS (fn), /*complain=*/1, NULL_TREE);
 
       if (DECL_CLASS_SCOPE_P (fn))
-       popclass (1);
+       popclass ();
 
       /* Make sure the default argument is reasonable.  */
       arg = check_default_argument (type, arg);
index e625776390c4c8f44fa068259f8d2671f4048ac6..0df7470d5084d558e8ade4dd9d0c6421b9bbc61e 100644 (file)
@@ -3143,7 +3143,7 @@ finish_struct_1 (t, warn_anon)
        cp_error ("redefinition of `%#T'", t);
       else
        my_friendly_abort (172);
-      popclass (1);
+      popclass ();
       return t;
     }
 
@@ -4220,7 +4220,7 @@ finish_struct (t, attributes, warn_anon)
   TYPE_BEING_DEFINED (t) = 0;
 
   if (current_class_type)
-    popclass (1);
+    popclass ();
   else
     error ("trying to finish struct, but kicked out due to previous parse errors.");
 
@@ -4551,36 +4551,25 @@ invalidate_class_lookup_cache ()
 }
  
 /* Get out of the current class scope. If we were in a class scope
-   previously, that is the one popped to.  The flag MODIFY tells whether
-   the current scope declarations needs to be modified as a result of
-   popping to the previous scope.  0 is used for class definitions.  */
+   previously, that is the one popped to.  */
 
 void
-popclass (modify)
-     int modify;
+popclass ()
 {
-  if (modify)
-    {
-      /* Just remove from this class what didn't make
+  /* Just remove from this class what didn't make
         it into IDENTIFIER_CLASS_VALUE.  */
-      tree tags = CLASSTYPE_TAGS (current_class_type);
+  tree tags = CLASSTYPE_TAGS (current_class_type);
 
-      while (tags)
-       {
-         TREE_NONLOCAL_FLAG (TREE_VALUE (tags)) = 0;
-         tags = TREE_CHAIN (tags);
-       }
+  while (tags)
+    {
+      TREE_NONLOCAL_FLAG (TREE_VALUE (tags)) = 0;
+      tags = TREE_CHAIN (tags);
     }
 
-  /* Force clearing of IDENTIFIER_CLASS_VALUEs after a class definition,
-     since not all class decls make it there currently.  */
-  poplevel_class (! modify);
-
+  poplevel (1, 0, 0);
   /* Since poplevel_class does the popping of class decls nowadays,
-     this really only frees the obstack used for these decls.
-     That's why it had to be moved down here.  */
-  if (modify)
-    pop_class_decls ();
+     this really only frees the obstack used for these decls.  */
+  pop_class_decls ();
 
   current_class_depth--;
   current_class_name = current_class_stack[current_class_depth].name;
@@ -4636,14 +4625,13 @@ push_nested_class (type, modify)
 /* Undoes a push_nested_class call.  MODIFY is passed on to popclass.  */
 
 void
-pop_nested_class (modify)
-     int modify;
+pop_nested_class ()
 {
   tree context = DECL_CONTEXT (TYPE_MAIN_DECL (current_class_type));
 
-  popclass (modify);
+  popclass ();
   if (context && TREE_CODE (context) == RECORD_TYPE)
-    pop_nested_class (modify);
+    pop_nested_class ();
 }
 
 /* Set global variables CURRENT_LANG_NAME to appropriate value
index acb94d5e91c6168ecbd233ec5c5fd885ffdd2b45..0ec7f8e91a4a130f8215702cd1623dd23e712686 100644 (file)
@@ -2721,9 +2721,9 @@ extern int resolves_to_fixed_type_p               PROTO((tree, int *));
 extern void init_class_processing              PROTO((void));
 extern int is_empty_class                      PROTO((tree));
 extern void pushclass                          PROTO((tree, int));
-extern void popclass                           PROTO((int));
+extern void popclass                           PROTO((void));
 extern void push_nested_class                  PROTO((tree, int));
-extern void pop_nested_class                   PROTO((int));
+extern void pop_nested_class                   PROTO((void));
 extern void push_lang_context                  PROTO((tree));
 extern void pop_lang_context                   PROTO((void));
 extern tree instantiate_type                   PROTO((tree, tree, int));
@@ -2775,7 +2775,6 @@ extern void insert_block                  PROTO((tree));
 extern void add_block_current_level            PROTO((tree));
 extern void set_block                          PROTO((tree));
 extern void pushlevel_class                    PROTO((void));
-extern tree poplevel_class                     PROTO((int));
 extern void print_binding_stack                        PROTO((void));
 extern void print_binding_level                        PROTO((struct binding_level *));
 extern void push_namespace                     PROTO((tree));
index 0fcad724a1a5062d1259380e3eaa8194f9742666..ce8754844ecc4c1e0682cf9895813e84effe675f 100644 (file)
@@ -191,6 +191,7 @@ static tree record_builtin_java_type PROTO((const char *, int));
 static const char *tag_name PROTO((enum tag_types code));
 static void find_class_binding_level PROTO((void));
 static struct binding_level *innermost_nonclass_level PROTO((void));
+static tree poplevel_class PROTO((void));
 
 #if defined (DEBUG_CP_BINDING_LEVELS)
 static void indent PROTO((void));
@@ -1330,11 +1331,11 @@ poplevel (keep, reverse, functionbody)
   int block_previously_created;
   int leaving_for_scope;
 
-  if (current_binding_level->parm_flag == 2
-      || current_binding_level->class_shadowed)
-    /* We should not be using poplevel to pop a class binding level.
-       Use poplevel_class instead.  */
-    my_friendly_abort (0);
+  if (current_binding_level->parm_flag == 2)
+    return poplevel_class ();
+
+  my_friendly_assert (!current_binding_level->class_shadowed,
+                     19990414);
 
   /* We used to use KEEP == 2 to indicate that the new block should go
      at the beginning of the list of blocks at this binding level,
@@ -1723,15 +1724,12 @@ pushlevel_class ()
   class_binding_level->parm_flag = 2;
 }
 
-/* ...and a poplevel for class declarations.  FORCE is used to force
-   clearing out of CLASS_VALUEs after a class definition.  */
+/* ...and a poplevel for class declarations.  */
 
-tree
-poplevel_class (force)
-     int force;
+static tree
+poplevel_class ()
 {
   register struct binding_level *level = class_binding_level;
-  tree block = NULL_TREE;
   tree shadowed;
 
   my_friendly_assert (level != 0, 354);
@@ -1742,7 +1740,7 @@ poplevel_class (force)
      shouldn't even be used when current_class_type isn't set, and second,
      if we don't touch it here, we're able to use the cache effect if the
      next time we're entering a class scope, it is the same class.  */
-  if (current_class_depth != 1 || force)
+  if (current_class_depth != 1)
     {
       struct binding_level* b;
 
@@ -1805,7 +1803,7 @@ poplevel_class (force)
 
   pop_binding_level ();
 
-  return block;
+  return NULL_TREE;
 }
 
 /* We are entering the scope of a class.  Clear IDENTIFIER_CLASS_VALUE
@@ -2533,7 +2531,7 @@ pop_everything ()
   while (!toplevel_bindings_p ())
     {
       if (current_binding_level->parm_flag == 2)
-       pop_nested_class (1);
+       pop_nested_class ();
       else
        poplevel (0, 0, 0);
     }
@@ -8160,7 +8158,7 @@ cp_finish_decl (decl, init, asmspec_tree, need_pop, flags)
               the binding level..  */
            && TYPE_SIZE (context) != NULL_TREE
            && context == current_class_type)
-         popclass (1);
+         popclass ();
       }
     }
 
@@ -10569,7 +10567,7 @@ grokdeclarator (declarator, declspecs, decl_context, initialized, attrlist)
                    push_nested_class used to push into class scope for
                    parsing the argument list of a function decl, in
                    qualified_id.  */
-               pop_nested_class (1);
+               pop_nested_class ();
                TREE_COMPLEXITY (declarator) = current_class_depth;
              }
            else
@@ -14129,7 +14127,7 @@ finish_function (lineno, flags, nested)
   if (current_class_name)
     {
       ctype = current_class_type;
-      pop_nested_class (1);
+      pop_nested_class ();
     }
 
   /* Must mark the RESULT_DECL as being in this function.  */
index 8f0375b82d43cb33846b3af141c7571ca4766fb5..3b7446cb784549b039d142d24a8c3ce88c86149a 100644 (file)
@@ -1505,7 +1505,7 @@ grokfield (declarator, declspecs, init, asmspec_tree, attrlist)
       if (! IS_AGGR_TYPE_CODE (TREE_CODE (TREE_OPERAND (declarator, 0))))
        ;
       else if (TREE_COMPLEXITY (declarator) == current_class_depth)
-       pop_nested_class (1);
+       pop_nested_class ();
       return do_class_using_decl (declarator);
     }
 
@@ -4380,7 +4380,7 @@ pop_scope (t)
   if (TREE_CODE (t) == NAMESPACE_DECL)
     pop_decl_namespace ();
   else
-    popclass (1);
+    popclass ();
 }
 
 /* [basic.lookup.koenig] */
index 4d68ba97bf4ff10a3092ad7a995203f3adb8ae66..84fd7a9910fb27063213aaa4fc19a4a2f35102e3 100644 (file)
@@ -1888,7 +1888,7 @@ do_pending_defargs ()
        }
 
       poplevel (0, 0, 0);
-      pop_nested_class (1);
+      pop_nested_class ();
     }
 }
 
index 78af73449515fd155c3afd4b8613b1dc3682c5ab..9a63099c88a265afcbebbf8634ef7cc3468c3aab 100644 (file)
@@ -4737,7 +4737,6 @@ instantiate_class_template (type)
   TYPE_BEING_DEFINED (type) = 1;
 
   maybe_push_to_top_level (uses_template_parms (type));
-  pushclass (type, 0);
 
   if (t)
     {
@@ -4882,6 +4881,13 @@ instantiate_class_template (type)
                      base_list);
     }
 
+  /* Now that our base classes are set up, enter the scope of the
+     class, so that name lookups into base classes, etc. will work
+     corectly.  This is precisely analagous to what we do in
+     begin_class_definition when defining an ordinary non-template
+     class.  */
+  pushclass (type, 1);
+
   for (t = CLASSTYPE_TAGS (pattern); t; t = TREE_CHAIN (t))
     {
       tree tag = TREE_VALUE (t);
@@ -5058,7 +5064,7 @@ instantiate_class_template (type)
   TYPE_BEING_DEFINED (type) = 0;
   repo_template_used (type);
 
-  popclass (0);
+  popclass ();
   pop_from_top_level ();
   pop_tinst_level ();
 
@@ -9077,7 +9083,7 @@ regenerate_decl_from_template (decl, tmpl)
        tsubst_expr (DECL_INITIAL (code_pattern), args, 
                     /*complain=*/1, DECL_TI_TEMPLATE (decl));
       /* Pop the class context we pushed above.  */
-      popclass (1);
+      popclass ();
     }
   else if (TREE_CODE (decl) == FUNCTION_DECL)
     {
This page took 0.107881 seconds and 5 git commands to generate.