diff options
author | Jason Merrill <jason@yorick.cygnus.com> | 1999-09-17 01:44:05 +0000 |
---|---|---|
committer | Jason Merrill <jason@gcc.gnu.org> | 1999-09-16 21:44:05 -0400 |
commit | 51925d8a2ab8562fa195eb84cf2f688b6195d7a3 (patch) | |
tree | a1e7c52670b5af2ae61e71a4e6c4d8bc59675ebe | |
parent | 0868989e574e03570ce6388a9b2e00fdbb63b0ee (diff) | |
download | gcc-51925d8a2ab8562fa195eb84cf2f688b6195d7a3.zip gcc-51925d8a2ab8562fa195eb84cf2f688b6195d7a3.tar.gz gcc-51925d8a2ab8562fa195eb84cf2f688b6195d7a3.tar.bz2 |
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
-rw-r--r-- | gcc/cp/ChangeLog | 6 | ||||
-rw-r--r-- | gcc/cp/class.c | 15 | ||||
-rw-r--r-- | gcc/cp/decl.c | 6 |
3 files changed, 22 insertions, 5 deletions
diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index 7603401..3f7d508 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -1,3 +1,9 @@ +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> * lex.c (init_cpp_parse): Call xcalloc, not malloc/bzero. diff --git a/gcc/cp/class.c b/gcc/cp/class.c index 2c6a03f..3b63503 100644 --- a/gcc/cp/class.c +++ b/gcc/cp/class.c @@ -4499,11 +4499,16 @@ pushclass (type, modify) /* Forcibly remove any old class remnants. */ invalidate_class_lookup_cache (); - /* Now, free the obstack on which we cached all the values. */ - if (class_cache_firstobj) - obstack_free (&class_cache_obstack, class_cache_firstobj); - class_cache_firstobj - = (char*) obstack_finish (&class_cache_obstack); + /* 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) + obstack_free (&class_cache_obstack, class_cache_firstobj); + class_cache_firstobj + = (char*) obstack_finish (&class_cache_obstack); + } } /* If we're about to enter a nested class, clear diff --git a/gcc/cp/decl.c b/gcc/cp/decl.c index cd42511..d8ad184 100644 --- a/gcc/cp/decl.c +++ b/gcc/cp/decl.c @@ -2481,6 +2481,12 @@ pop_from_top_level () free (s); } + +int +saved_scope_p () +{ + return current_saved_scope != NULL; +} /* Push a definition of struct, union or enum tag "name". into binding_level "b". "type" should be the type node, |