cp-tree.h (lang_identifier): Remove class_value.
authorMark Mitchell <mark@codesourcery.com>
Tue, 13 Jul 2004 16:22:06 +0000 (16:22 +0000)
committerMark Mitchell <mmitchel@gcc.gnu.org>
Tue, 13 Jul 2004 16:22:06 +0000 (16:22 +0000)
* cp-tree.h (lang_identifier): Remove class_value.
(IDENTIFIER_CLASS_VALUE): Remove.
(pop_class_decls): Likewise.
(init_search_processing): Likewise.
* class.c (handle_using_decl): Use lookup_member, not
IDENTIFIER_CLASS_VALUE.
(restore_class_cache): New function, split out from ...
(pushclass): ... here.  Do not call clear_identifier_class_values.
(invalidate_class_lookup_cache): Do not clear
IDENTIFIER_CLASS_VALUE.
(popclass): Do not call pop_class_decls.
(maybe_note_name_used_in_class): Do not save names looked up after
the class is complete.  Use lookup_member, not
IDENTIFIER_CLASS_VALUE.
* config-lang.in (gtfiles): Add $(srcdir)/cp/search.c.
* decl.c (cxx_init_decl_processing): Do not call
init_search_processing.
* method.c (do_build_copy_constructor): Remove unnecessary code.
(do_build_assign_ref): Likewise.
* name-lookup.c (pushdecl): Use lookup_member, not
IDENTIFIER_CLASS_VALUE.
(set_identifier_type_value_with_scope): Set TREE_TYPE on the
type_shadowed list.
(poplevel_class): Do not restore IDENTIFIER_CLASS_VALUE.
(push_class_binding): Do not set it.
(clear_identifier_class_values): Remove.
(push_class_level_binding): Do not set IDENTIFIER_CLASS_VALUE.
(store_binding): Do not save it.
(pop_from_top_level): Do not restore it.
* name-lookup.h (cxx_saved_binding): Remove class_value.
(clear_identifier_class_values): Remove.
* ptree.c (cxx_print_identifier): Do not print
IDENTIFIER_CLASS_VALUE.
* search.c (search_obstack): Remove.
(push_stack_level): Remove.
(pop_stack_level): Remove.
(search_level): Remove.
(search_stack): Remove.
(lookup_member): Don't check IDENTIFIER_CLASS_VALUE.
(setup_class_bindings): Use IDENTIFIER_MARKED, not
IDENTIFIER_CLASS_VALUE.
(marked_identifiers): New variable.
(push_class_decls): Clear IDENTIFIER_MARKED.
(pop_class_decls): Don't call pop_search_level.
(init_search_processing): Remove.

From-SVN: r84629

gcc/cp/ChangeLog
gcc/cp/class.c
gcc/cp/config-lang.in
gcc/cp/cp-tree.h
gcc/cp/decl.c
gcc/cp/method.c
gcc/cp/name-lookup.c
gcc/cp/name-lookup.h
gcc/cp/ptree.c
gcc/cp/search.c

index b94b245d5e9a22cda6e5e92c7abc81ba101d369b..aaf5e25a85dfb1ed9d3d3808e1ca1bd6e8ee0485 100644 (file)
@@ -1,3 +1,51 @@
+2004-07-13  Mark Mitchell  <mark@codesourcery.com>
+
+       * cp-tree.h (lang_identifier): Remove class_value.
+       (IDENTIFIER_CLASS_VALUE): Remove.
+       (pop_class_decls): Likewise.
+       (init_search_processing): Likewise.
+       * class.c (handle_using_decl): Use lookup_member, not
+       IDENTIFIER_CLASS_VALUE.
+       (restore_class_cache): New function, split out from ...
+       (pushclass): ... here.  Do not call clear_identifier_class_values.
+       (invalidate_class_lookup_cache): Do not clear
+       IDENTIFIER_CLASS_VALUE.
+       (popclass): Do not call pop_class_decls.
+       (maybe_note_name_used_in_class): Do not save names looked up after
+       the class is complete.  Use lookup_member, not
+       IDENTIFIER_CLASS_VALUE.
+       * config-lang.in (gtfiles): Add $(srcdir)/cp/search.c.
+       * decl.c (cxx_init_decl_processing): Do not call
+       init_search_processing.
+       * method.c (do_build_copy_constructor): Remove unnecessary code.
+       (do_build_assign_ref): Likewise.
+       * name-lookup.c (pushdecl): Use lookup_member, not
+       IDENTIFIER_CLASS_VALUE.
+       (set_identifier_type_value_with_scope): Set TREE_TYPE on the
+       type_shadowed list.
+       (poplevel_class): Do not restore IDENTIFIER_CLASS_VALUE.
+       (push_class_binding): Do not set it.
+       (clear_identifier_class_values): Remove.
+       (push_class_level_binding): Do not set IDENTIFIER_CLASS_VALUE.
+       (store_binding): Do not save it.
+       (pop_from_top_level): Do not restore it.
+       * name-lookup.h (cxx_saved_binding): Remove class_value.
+       (clear_identifier_class_values): Remove.
+       * ptree.c (cxx_print_identifier): Do not print
+       IDENTIFIER_CLASS_VALUE.
+       * search.c (search_obstack): Remove.
+       (push_stack_level): Remove.
+       (pop_stack_level): Remove.
+       (search_level): Remove.
+       (search_stack): Remove.
+       (lookup_member): Don't check IDENTIFIER_CLASS_VALUE.
+       (setup_class_bindings): Use IDENTIFIER_MARKED, not
+       IDENTIFIER_CLASS_VALUE.
+       (marked_identifiers): New variable.
+       (push_class_decls): Clear IDENTIFIER_MARKED.
+       (pop_class_decls): Don't call pop_search_level.
+       (init_search_processing): Remove.
+
 2004-07-12  Mark Mitchell  <mark@codesourcery.com>
 
        * cp-tree.h (get_aggr_typedef): Remove.
index 2e5b89b5b0b232cfdfaa1cdb9e5ca32aeed058bb..907503d51706895dd3a408835db364c02321d0e9 100644 (file)
@@ -1130,7 +1130,7 @@ handle_using_decl (tree using_decl, tree t)
     /* Ignore base type this came from.  */
     fdecl = BASELINK_FUNCTIONS (fdecl);
 
-  old_value = IDENTIFIER_CLASS_VALUE (name);
+  old_value = lookup_member (t, name, /*protect=*/0, /*want_type=*/false);
   if (old_value)
     {
       if (is_overloaded_fn (old_value))
@@ -5479,6 +5479,40 @@ init_class_processing (void)
   ridpointers[(int) RID_PROTECTED] = access_protected_node;
 }
 
+/* Restore the cached PREVIOUS_CLASS_LEVEL.  */
+
+static void
+restore_class_cache (void)
+{
+  cp_class_binding *cb;
+  tree type;
+  size_t i;
+
+  /* We are re-entering the same class we just left, so we don't
+     have to search the whole inheritance matrix to find all the
+     decls to bind again.  Instead, we install the cached
+     class_shadowed list and walk through it binding names.  */
+  push_binding_level (previous_class_level);
+  class_binding_level = previous_class_level;
+  for (i = 0; 
+       (cb = VEC_iterate (cp_class_binding, 
+                         previous_class_level->class_shadowed,
+                         i));
+       ++i)
+    {
+      tree id;
+
+      id = cb->identifier;
+      cb->base.previous = IDENTIFIER_BINDING (id);
+      IDENTIFIER_BINDING (id) = &cb->base;
+    }
+  /* Restore IDENTIFIER_TYPE_VALUE.  */
+  for (type = class_binding_level->type_shadowed; 
+       type; 
+       type = TREE_CHAIN (type))
+    SET_IDENTIFIER_TYPE_VALUE (TREE_PURPOSE (type), TREE_TYPE (type));
+}
+
 /* Set global variables CURRENT_CLASS_NAME and CURRENT_CLASS_TYPE as
    appropriate for TYPE.
 
@@ -5486,12 +5520,7 @@ init_class_processing (void)
    nodes of local TYPE_DECLs in the TREE_TYPE field of the name.
 
    For multiple inheritance, we perform a two-pass depth-first search
-   of the type lattice.  The first pass performs a pre-order search,
-   marking types after the type has had its fields installed in
-   the appropriate IDENTIFIER_CLASS_VALUE slot.  The second pass merely
-   unmarks the marked types.  If a field or member function name
-   appears in an ambiguous way, the IDENTIFIER_CLASS_VALUE of
-   that name becomes `error_mark_node'.  */
+   of the type lattice.  */
 
 void
 pushclass (tree type)
@@ -5535,11 +5564,6 @@ pushclass (tree type)
       invalidate_class_lookup_cache ();
     }
 
-  /* If we're about to enter a nested class, clear
-     IDENTIFIER_CLASS_VALUE for the enclosing classes.  */
-  if (current_class_depth > 1)
-    clear_identifier_class_values ();
-
   if (!previous_class_level 
       || type != previous_class_level->this_entity
       || current_class_depth > 1)
@@ -5560,58 +5584,18 @@ pushclass (tree type)
        }
     }
   else
-    {
-      cp_class_binding *cb;
-      size_t i;
-
-      /* We are re-entering the same class we just left, so we don't
-        have to search the whole inheritance matrix to find all the
-        decls to bind again.  Instead, we install the cached
-        class_shadowed list, and walk through it binding names and
-        setting up IDENTIFIER_TYPE_VALUEs.  */
-      push_binding_level (previous_class_level);
-      class_binding_level = previous_class_level;
-      for (i = 0; 
-          (cb = VEC_iterate (cp_class_binding, 
-                             previous_class_level->class_shadowed,
-                             i));
-          ++i)
-       {
-         tree id;
-         tree type_decl;
-
-         id = cb->identifier;
-         cb->base.previous = IDENTIFIER_BINDING (id);
-         IDENTIFIER_BINDING (id) = &cb->base;
-         type_decl = cb->base.value;
-         if (!type_decl || TREE_CODE (type_decl) != TYPE_DECL)
-           type_decl = cb->base.type;
-         if (type_decl && TREE_CODE (type_decl) == TYPE_DECL)
-           set_identifier_type_value (id, type_decl);
-       }
-    }
+    restore_class_cache ();
   
   cxx_remember_type_decls (CLASSTYPE_NESTED_UTDS (type));
 }
 
-/* When we exit a toplevel class scope, we save the
-   IDENTIFIER_CLASS_VALUEs so that we can restore them quickly if we
-   reenter the class.  Here, we've entered some other class, so we
-   must invalidate our cache.  */
+/* When we exit a toplevel class scope, we save its binding level so
+   that we can restore it quickly.  Here, we've entered some other
+   class, so we must invalidate our cache.  */
 
 void
 invalidate_class_lookup_cache (void)
 {
-  size_t i;
-  cp_class_binding *cb;
-  
-  /* The IDENTIFIER_CLASS_VALUEs are no longer valid.  */
-  for (i = 0;
-       (cb = VEC_iterate (cp_class_binding, 
-                         previous_class_level->class_shadowed, i));
-       ++i)
-    IDENTIFIER_CLASS_VALUE (cb->identifier) = NULL_TREE;
-
   previous_class_level = NULL;
 }
  
@@ -5622,7 +5606,6 @@ void
 popclass (void)
 {
   poplevel_class ();
-  pop_class_decls ();
 
   current_class_depth--;
   current_class_name = current_class_stack[current_class_depth].name;
@@ -6448,12 +6431,14 @@ maybe_note_name_used_in_class (tree name, tree decl)
   splay_tree names_used;
 
   /* If we're not defining a class, there's nothing to do.  */
-  if (innermost_scope_kind() != sk_class)
+  if (!(innermost_scope_kind() == sk_class
+       && TYPE_BEING_DEFINED (current_class_type)))
     return;
   
   /* If there's already a binding for this NAME, then we don't have
      anything to worry about.  */
-  if (IDENTIFIER_CLASS_VALUE (name))
+  if (lookup_member (current_class_type, name, 
+                    /*protect=*/0, /*want_type=*/false))
     return;
 
   if (!current_class_stack[current_class_depth - 1].names_used)
index 563cfb4d1c02e231aa64b30b0c29deca53827336..48b88d7052d94edb6b1db09274868b34365e5fb2 100644 (file)
@@ -34,4 +34,4 @@ stagestuff="g++\$(exeext) g++-cross\$(exeext) cc1plus\$(exeext)"
 
 target_libs="target-libstdc++-v3 target-gperf"
 
-gtfiles="\$(srcdir)/cp/mangle.c \$(srcdir)/cp/name-lookup.h \$(srcdir)/cp/name-lookup.c \$(srcdir)/cp/cp-tree.h \$(srcdir)/cp/decl.h \$(srcdir)/cp/call.c \$(srcdir)/cp/decl.c \$(srcdir)/cp/decl2.c \$(srcdir)/cp/pt.c \$(srcdir)/cp/repo.c \$(srcdir)/cp/semantics.c \$(srcdir)/cp/tree.c \$(srcdir)/cp/parser.c \$(srcdir)/cp/method.c \$(srcdir)/cp/typeck2.c \$(srcdir)/c-common.c \$(srcdir)/c-common.h \$(srcdir)/c-lex.c \$(srcdir)/c-pragma.c"
+gtfiles="\$(srcdir)/cp/mangle.c \$(srcdir)/cp/name-lookup.h \$(srcdir)/cp/name-lookup.c \$(srcdir)/cp/cp-tree.h \$(srcdir)/cp/decl.h \$(srcdir)/cp/call.c \$(srcdir)/cp/decl.c \$(srcdir)/cp/decl2.c \$(srcdir)/cp/pt.c \$(srcdir)/cp/repo.c \$(srcdir)/cp/search.c \$(srcdir)/cp/semantics.c \$(srcdir)/cp/tree.c \$(srcdir)/cp/parser.c \$(srcdir)/cp/method.c \$(srcdir)/cp/typeck2.c \$(srcdir)/c-common.c \$(srcdir)/c-common.h \$(srcdir)/c-lex.c \$(srcdir)/c-pragma.c"
index 3311bc037971fa315477d3a1aa26507ed3f33b3c..6e5dfdfa485c876400159dd6e4dfacaa0eadff6f 100644 (file)
@@ -170,7 +170,6 @@ struct lang_identifier GTY(())
   struct c_common_identifier c_common;
   cxx_binding *namespace_bindings;
   cxx_binding *bindings;
-  tree class_value;
   tree class_template_info;
   tree label_value;
 };
@@ -340,14 +339,6 @@ typedef enum cp_id_kind
 #define IDENTIFIER_VALUE(NODE)                 \
   (IDENTIFIER_BINDING (NODE) ? IDENTIFIER_BINDING (NODE)->value : NULL)
 
-/* If IDENTIFIER_CLASS_VALUE is set, then NODE is bound in the current
-   class, and IDENTIFIER_CLASS_VALUE is the value binding.  This is
-   just a pointer to the VALUE field of one of the bindings in the
-   IDENTIFIER_BINDINGs list, so any time that this is non-NULL so is
-   IDENTIFIER_BINDING.  */
-#define IDENTIFIER_CLASS_VALUE(NODE) \
-  (LANG_IDENTIFIER_CAST (NODE)->class_value)
-
 /* TREE_TYPE only indicates on local and class scope the current
    type. For namespace scope, the presence of a type in any namespace
    is indicated with global_type_node, and the real type behind must
@@ -4013,9 +4004,7 @@ extern void get_pure_virtuals                     (tree);
 extern void maybe_suppress_debug_info          (tree);
 extern void note_debug_info_needed             (tree);
 extern void push_class_decls                   (tree);
-extern void pop_class_decls                    (void);
 extern void print_search_statistics            (void);
-extern void init_search_processing             (void);
 extern void reinit_search_statistics           (void);
 extern tree current_scope                      (void);
 extern int at_function_scope_p                  (void);
index 4c6180caa32a5decb84a6bce5293fa630d97dfaf..f5d4bd37a47ae55711e89650f01f1a3cbcbaf8b1 100644 (file)
@@ -3047,7 +3047,6 @@ cxx_init_decl_processing (void)
 
   /* Perform other language dependent initializations.  */
   init_class_processing ();
-  init_search_processing ();
   init_rtti_processing ();
 
   if (flag_exceptions)
index 6acf765cbc5f48eb3f403d6d84a5241f72662cee..63fd1e7a10b7d50cea56ced69b6d3d53cdffac4a 100644 (file)
@@ -567,10 +567,6 @@ do_build_copy_constructor (tree fndecl)
            {
              if (VFIELD_NAME_P (DECL_NAME (field)))
                continue;
-
-             /* True for duplicate members.  */
-             if (IDENTIFIER_CLASS_VALUE (DECL_NAME (field)) != field)
-               continue;
            }
          else if ((t = TREE_TYPE (field)) != NULL_TREE
                   && ANON_AGGR_TYPE_P (t)
@@ -673,10 +669,6 @@ do_build_assign_ref (tree fndecl)
            {
              if (VFIELD_NAME_P (DECL_NAME (field)))
                continue;
-
-             /* True for duplicate members.  */
-             if (IDENTIFIER_CLASS_VALUE (DECL_NAME (field)) != field)
-               continue;
            }
          else if ((t = TREE_TYPE (field)) != NULL_TREE
                   && ANON_AGGR_TYPE_P (t)
index b063c0d6f62a9e3c0c8f14df0efacfb65b1422be..1511ff972892659e40f1df389d56a47354e9bd5e 100644 (file)
@@ -997,9 +997,17 @@ pushdecl (tree x)
              /* No shadow warnings for vars made for inlining.  */
              && ! DECL_FROM_INLINE (x))
            {
-             if (IDENTIFIER_CLASS_VALUE (name) != NULL_TREE
-                      && current_class_ptr
-                      && !TREE_STATIC (name))
+             tree member;
+
+             if (current_class_ptr)
+               member = lookup_member (current_class_type,
+                                       name,
+                                       /*protect=*/0,
+                                       /*want_type=*/false);
+             else
+               member = NULL_TREE;
+                 
+             if (member && !TREE_STATIC (member))
                {
                  /* Location of previous decl is not useful in this case.  */
                  warning ("declaration of '%D' shadows a member of 'this'",
@@ -1777,6 +1785,7 @@ set_identifier_type_value_with_scope (tree id, tree decl, cxx_scope *b)
       b->type_shadowed
        = tree_cons (id, old_type_value, b->type_shadowed);
       type = decl ? TREE_TYPE (decl) : NULL_TREE;
+      TREE_TYPE (b->type_shadowed) = type;
     }
   else
     {
@@ -2629,46 +2638,8 @@ poplevel_class (void)
   timevar_push (TV_NAME_LOOKUP);
   my_friendly_assert (level != 0, 354);
 
-  /* If we're leaving a toplevel class, don't bother to do the setting
-     of IDENTIFIER_CLASS_VALUE to NULL_TREE, since first of all this slot
-     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)
-    {
-      struct cp_binding_level* b;
-      cp_class_binding* cb;
-      size_t i;
-
-      /* Clear out our IDENTIFIER_CLASS_VALUEs.  */
-      clear_identifier_class_values ();
-
-      /* Find the next enclosing class, and recreate
-        IDENTIFIER_CLASS_VALUEs appropriate for that class.  */
-      b = level->level_chain;
-      while (b && b->kind != sk_class)
-       b = b->level_chain;
-
-      if (b)
-       for (i = 0;
-            (cb = VEC_iterate (cp_class_binding, 
-                               b->class_shadowed, 
-                               i));
-            ++i)
-         {
-           cxx_binding *binding;
-            
-           binding = IDENTIFIER_BINDING (cb->identifier);
-           while (binding && binding->scope != b)
-             binding = binding->previous;
-
-           if (binding)
-             IDENTIFIER_CLASS_VALUE (cb->identifier) = binding->value;
-         }
-    }
-  else
-    /* Remember to save what IDENTIFIER's were bound in this scope so we
-       can recover from cache misses.  */
+  /* If we're leaving a toplevel class, cache its binding level.  */
+  if (current_class_depth == 1)
     previous_class_level = level;
   for (shadowed = level->type_shadowed;
        shadowed;
@@ -2713,13 +2684,6 @@ push_class_binding (tree id, tree decl)
     /* Create a new binding.  */
     push_binding (id, decl, class_binding_level);
 
-  /* Update the IDENTIFIER_CLASS_VALUE for this ID to be the
-     class-level declaration.  Note that we do not use DECL here
-     because of the possibility of the `struct stat' hack; if DECL is
-     a class-name or enum-name we might prefer a field-name, or some
-     such.  */
-  IDENTIFIER_CLASS_VALUE (id) = IDENTIFIER_BINDING (id)->value;
-
   /* If this is a binding from a base class, mark it as such.  */
   binding = IDENTIFIER_BINDING (id);
   if (binding->value == decl && TREE_CODE (decl) != TREE_LIST)
@@ -2746,24 +2710,6 @@ push_class_binding (tree id, tree decl)
   POP_TIMEVAR_AND_RETURN (TV_NAME_LOOKUP, result);
 }
 
-/* We are entering the scope of a class.  Clear IDENTIFIER_CLASS_VALUE
-   for any names in enclosing classes.  */
-
-void
-clear_identifier_class_values (void)
-{
-  size_t i;
-  cp_class_binding *cb;
-
-  if (class_binding_level)
-    for (i = 0;
-        (cb = VEC_iterate (cp_class_binding, 
-                           class_binding_level->class_shadowed, 
-                           i));
-        ++i)
-      IDENTIFIER_CLASS_VALUE (cb->identifier) = NULL_TREE;
-}
-
 /* Make the declaration of X appear in CLASS scope.  */
 
 bool
@@ -2821,9 +2767,9 @@ push_class_level_binding (tree name, tree x)
     POP_TIMEVAR_AND_RETURN (TV_NAME_LOOKUP, true);
 
   /* Check for invalid member names, if the class is being defined.
-     This function is also used to restore IDENTIFIER_CLASS_VALUE,
-     when reentering the class scope, and there is no point in
-     checking again at that time.  */
+     This function is also used to restore bindings when reentering
+     the class scope, and there is no point in checking again at that
+     time.  */
   if (TYPE_BEING_DEFINED (current_class_type))
     {
       tree decl = x;
@@ -2875,8 +2821,8 @@ push_class_level_binding (tree name, tree x)
     }
 
   /* If this declaration shadows a declaration from an enclosing
-     class, then we will need to restore IDENTIFIER_CLASS_VALUE when
-     we leave this class.  Record the shadowed declaration here.  */
+     class, then we will need to restore bindings when we leave this
+     class.  Record the shadowed declaration here.  */
   binding = IDENTIFIER_BINDING (name);
   if (binding && binding->value)
     {
@@ -2922,7 +2868,6 @@ push_class_level_binding (tree name, tree x)
             coming from a definition in the body of the class
             itself.  */
          INHERITED_VALUE_BINDING_P (binding) = 0;
-         IDENTIFIER_CLASS_VALUE (name) = x;
          POP_TIMEVAR_AND_RETURN (TV_NAME_LOOKUP, true);
        }
     }
@@ -3994,11 +3939,8 @@ qualified_lookup_using_namespace (tree name, tree scope,
    If PREFER_TYPE is > 1, we reject non-type decls (e.g. namespaces).
    Otherwise we prefer non-TYPE_DECLs.
 
-   If NONCLASS is nonzero, we don't look for the NAME in class scope,
-   using IDENTIFIER_CLASS_VALUE.  
-
-   If BLOCK_P is true, block scopes are examined; otherwise, they are
-   skipped.  */
+   If NONCLASS is nonzero, bindings in class scopes are ignored.  If
+   BLOCK_P is false, bindings in block scopes are ignored.  */
 
 tree
 lookup_name_real (tree name, int prefer_type, int nonclass, bool block_p,
@@ -4831,11 +4773,7 @@ store_binding (tree id, VEC(cxx_saved_binding) **old_bindings)
 {
   cxx_saved_binding *saved;
 
-  if (!id
-      /* Note that we may have an IDENTIFIER_CLASS_VALUE even when
-        we have no IDENTIFIER_BINDING if we have left the class
-        scope, but cached the class-level declarations.  */
-      || !(IDENTIFIER_BINDING (id) || IDENTIFIER_CLASS_VALUE (id)))
+  if (!id || !IDENTIFIER_BINDING (id))
     return;
 
   if (IDENTIFIER_MARKED (id))
@@ -4846,10 +4784,8 @@ store_binding (tree id, VEC(cxx_saved_binding) **old_bindings)
   saved = VEC_safe_push (cxx_saved_binding, *old_bindings, NULL);
   saved->identifier = id;
   saved->binding = IDENTIFIER_BINDING (id);
-  saved->class_value = IDENTIFIER_CLASS_VALUE (id);;
   saved->real_type_value = REAL_IDENTIFIER_TYPE_VALUE (id);
   IDENTIFIER_BINDING (id) = NULL;
-  IDENTIFIER_CLASS_VALUE (id) = NULL_TREE;
 }
 
 static void
@@ -4981,7 +4917,6 @@ pop_from_top_level (void)
       tree id = saved->identifier;
 
       IDENTIFIER_BINDING (id) = saved->binding;
-      IDENTIFIER_CLASS_VALUE (id) = saved->class_value;
       SET_IDENTIFIER_TYPE_VALUE (id, saved->real_type_value);
     }
 
index 1b35b466a53e5b652f23575fa417416027eb1461..8d60f393ef30b210d195c4052850c3167a23333d 100644 (file)
@@ -88,7 +88,6 @@ typedef struct cxx_saved_binding GTY(())
   tree identifier;
   /* The binding we're saving.  */
   cxx_binding *binding;
-  tree class_value;
   tree real_type_value;
 } cxx_saved_binding;
 
@@ -97,7 +96,6 @@ DEF_VEC_O(cxx_saved_binding);
 extern tree identifier_type_value (tree);
 extern void set_identifier_type_value (tree, tree);
 extern void pop_binding (tree, tree);
-extern void clear_identifier_class_values (void);
 extern tree constructor_name_full (tree);
 extern tree constructor_name (tree);
 extern bool constructor_name_p (tree, tree);
index ba5533a36dda5664faccafaa079d3b417883d584..a74edc37dea44dfb3f85aceae78cdbe084d590b7 100644 (file)
@@ -157,7 +157,6 @@ cxx_print_identifier (FILE *file, tree node, int indent)
 {
   indent_to (file, indent);
   cxx_print_binding (file, IDENTIFIER_NAMESPACE_BINDINGS (node), "bindings");
-  print_node (file, "class", IDENTIFIER_CLASS_VALUE (node), indent + 4);
   indent_to (file, indent);
   cxx_print_binding (file, IDENTIFIER_BINDING (node), "local bindings");
   print_node (file, "label", IDENTIFIER_LABEL_VALUE (node), indent + 4);
index 83925b8d2fdb904653712269773f9b8cbb746a17..460b24089042011d4517af1b683a5e5bde2475d6 100644 (file)
@@ -36,39 +36,6 @@ Boston, MA 02111-1307, USA.  */
 #include "toplev.h"
 #include "stack.h"
 
-/* Obstack used for remembering decision points of breadth-first.  */
-
-static struct obstack search_obstack;
-
-/* Methods for pushing and popping objects to and from obstacks.  */
-
-struct stack_level *
-push_stack_level (struct obstack *obstack, char *tp,/* Sony NewsOS 5.0 compiler doesn't like void * here.  */
-                 int size)
-{
-  struct stack_level *stack;
-  obstack_grow (obstack, tp, size);
-  stack = (struct stack_level *) ((char*)obstack_next_free (obstack) - size);
-  obstack_finish (obstack);
-  stack->obstack = obstack;
-  stack->first = (tree *) obstack_base (obstack);
-  stack->limit = obstack_room (obstack) / sizeof (tree *);
-  return stack;
-}
-
-struct stack_level *
-pop_stack_level (struct stack_level *stack)
-{
-  struct stack_level *tem = stack;
-  struct obstack *obstack = tem->obstack;
-  stack = tem->prev;
-  obstack_free (obstack, tem);
-  return stack;
-}
-
-#define search_level stack_level
-static struct search_level *search_stack;
-
 struct vbase_info 
 {
   /* The class dominating the hierarchy.  */
@@ -90,9 +57,6 @@ static tree dfs_push_type_decls (tree, void *);
 static tree dfs_push_decls (tree, void *);
 static tree add_conversions (tree, void *);
 static int look_for_overrides_r (tree, tree);
-static struct search_level *push_search_level (struct stack_level *,
-                                              struct obstack *);
-static struct search_level *pop_search_level (struct stack_level *);
 static tree bfs_walk (tree, tree (*) (tree, void *),
                      tree (*) (tree, int, void *), void *);
 static tree lookup_field_queue_p (tree, int, void *);
@@ -108,26 +72,6 @@ static void setup_class_bindings (tree, int);
 static int template_self_reference_p (tree, tree);
 static tree dfs_get_pure_virtuals (tree, void *);
 
-/* Allocate a level of searching.  */
-
-static struct search_level *
-push_search_level (struct stack_level *stack, struct obstack *obstack)
-{
-  struct search_level tem;
-
-  tem.prev = stack;
-  return push_stack_level (obstack, (char *)&tem, sizeof (tem));
-}
-
-/* Discard a level of search allocation.  */
-
-static struct search_level *
-pop_search_level (struct stack_level *obstack)
-{
-  struct search_level *stack = pop_stack_level (obstack);
-
-  return stack;
-}
 \f
 /* Variables for gathering statistics.  */
 #ifdef GATHER_STATISTICS
@@ -1263,17 +1207,6 @@ lookup_member (tree xbasetype, tree name, int protect, bool want_type)
       xbasetype = NULL_TREE;
     }
 
-  if (type == current_class_type && TYPE_BEING_DEFINED (type)
-      && IDENTIFIER_CLASS_VALUE (name))
-    {
-      tree field = IDENTIFIER_CLASS_VALUE (name);
-      if (! is_overloaded_fn (field)
-         && ! (want_type && TREE_CODE (field) != TYPE_DECL))
-       /* We're in the scope of this class, and the value has already
-          been looked up.  Just return the cached value.  */
-       return field;
-    }
-
   type = complete_type (type);
   if (!basetype_path)
     basetype_path = TYPE_BINFO (type);
@@ -2099,6 +2032,11 @@ note_debug_info_needed (tree type)
   dfs_walk (TYPE_BINFO (type), dfs_debug_mark, dfs_debug_unmarkedp, 0);
 }
 \f
+/* A vector of IDENTIFIER_NODEs that have been processed by
+   setup_class_bindings.  */
+
+static GTY(()) VEC(tree) *marked_identifiers;
+
 /* Subroutines of push_class_decls ().  */
 
 static void
@@ -2109,9 +2047,12 @@ setup_class_bindings (tree name, int type_binding_p)
 
   /* If we've already done the lookup for this declaration, we're
      done.  */
-  if (IDENTIFIER_CLASS_VALUE (name))
+  if (IDENTIFIER_MARKED (name))
     return;
 
+  IDENTIFIER_MARKED (name) = 1;
+  VEC_safe_push (tree, marked_identifiers, name);
+
   /* First, deal with the type binding.  */
   if (type_binding_p)
     {
@@ -2161,8 +2102,13 @@ setup_class_bindings (tree name, int type_binding_p)
            {
              tree fns;
              for (fns = value_binding; fns; fns = OVL_NEXT (fns))
-               if (IDENTIFIER_CLASS_VALUE (DECL_NAME (OVL_CURRENT (fns))))
-                 return;
+               {
+                 tree name = DECL_NAME (OVL_CURRENT (fns));
+                 if (IDENTIFIER_MARKED (name))
+                   return;
+                 IDENTIFIER_MARKED (name) = 1;
+                 VEC_safe_push (tree, marked_identifiers, name);
+               }
            }
          pushdecl_class_level (value_binding);
        }
@@ -2245,7 +2191,8 @@ dfs_push_decls (tree binfo, void *data)
 void
 push_class_decls (tree type)
 {
-  search_stack = push_search_level (search_stack, &search_obstack);
+  tree id;
+  size_t i;
 
   if (!TYPE_BINFO (type))
     /* This occurs when parsing an invalid declarator id where the
@@ -2257,15 +2204,14 @@ push_class_decls (tree type)
 
   /* Enter non-type declarations and unmark.  */
   dfs_walk (TYPE_BINFO (type), dfs_push_decls, marked_pushdecls_p, 0);
-}
 
-void
-pop_class_decls (void)
-{
-  /* We haven't pushed a search level when dealing with cached classes,
-     so we'd better not try to pop it.  */
-  if (search_stack)
-    search_stack = pop_search_level (search_stack);
+  /* Clear the IDENTIFIER_MARKED bits.  */
+  for (i = 0;
+       (id = VEC_iterate (tree, marked_identifiers, i));
+       ++i)
+    IDENTIFIER_MARKED (id) = 0;
+  if (marked_identifiers)
+    VEC_truncate (tree, marked_identifiers, 0);
 }
 
 void
@@ -2282,12 +2228,6 @@ print_search_statistics (void)
 #endif /* GATHER_STATISTICS */
 }
 
-void
-init_search_processing (void)
-{
-  gcc_obstack_init (&search_obstack);
-}
-
 void
 reinit_search_statistics (void)
 {
@@ -2593,3 +2533,4 @@ original_binfo (tree binfo, tree here)
   return result;
 }
 
+#include "gt-cp-search.h"