Commit 51925d8a by Jason Merrill Committed by Jason Merrill

decl.c (saved_scope_p): New fn.

	* decl.c (saved_scope_p): New fn.
	* class.c (pushclass): Don't clear class_cache_obstack if we have
	saved scopes.

From-SVN: r29468
parent 0868989e
1999-09-16 Jason Merrill <jason@yorick.cygnus.com>
* decl.c (saved_scope_p): New fn.
* class.c (pushclass): Don't clear class_cache_obstack if we have
saved scopes.
1999-09-16 Kaveh R. Ghazi <ghazi@caip.rutgers.edu> 1999-09-16 Kaveh R. Ghazi <ghazi@caip.rutgers.edu>
* lex.c (init_cpp_parse): Call xcalloc, not malloc/bzero. * lex.c (init_cpp_parse): Call xcalloc, not malloc/bzero.
......
...@@ -4499,12 +4499,17 @@ pushclass (type, modify) ...@@ -4499,12 +4499,17 @@ pushclass (type, modify)
/* Forcibly remove any old class remnants. */ /* Forcibly remove any old class remnants. */
invalidate_class_lookup_cache (); invalidate_class_lookup_cache ();
/* Now, free the obstack on which we cached all the values. */ /* Now, free the obstack on which we cached all the values.
We can't do this if we have saved scopes sitting around, since
they may have saved previous_class_values. */
if (! saved_scope_p ())
{
if (class_cache_firstobj) if (class_cache_firstobj)
obstack_free (&class_cache_obstack, class_cache_firstobj); obstack_free (&class_cache_obstack, class_cache_firstobj);
class_cache_firstobj class_cache_firstobj
= (char*) obstack_finish (&class_cache_obstack); = (char*) obstack_finish (&class_cache_obstack);
} }
}
/* If we're about to enter a nested class, clear /* If we're about to enter a nested class, clear
IDENTIFIER_CLASS_VALUE for the enclosing classes. */ IDENTIFIER_CLASS_VALUE for the enclosing classes. */
......
...@@ -2482,6 +2482,12 @@ pop_from_top_level () ...@@ -2482,6 +2482,12 @@ pop_from_top_level ()
free (s); free (s);
} }
int
saved_scope_p ()
{
return current_saved_scope != NULL;
}
/* Push a definition of struct, union or enum tag "name". /* Push a definition of struct, union or enum tag "name".
into binding_level "b". "type" should be the type node, into binding_level "b". "type" should be the type node,
We assume that the tag "name" is not already defined. We assume that the tag "name" is not already defined.
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment