decl.c (pop_cp_function_context): Don't call free on a NULL pointer.

* decl.c (pop_cp_function_context): Don't call free on a NULL
	pointer.
	* semantics.c: Include ggc.h.
	(expand_body): Do garbage-collection after processing a template
	function.  Clear DECL_SAVED_TREE after generating RTL for a
	function.
	* Makefile.in (semantics.o): Depend on ggc.h.

From-SVN: r30279
This commit is contained in:
Mark Mitchell 1999-10-30 23:32:55 +00:00 committed by Mark Mitchell
parent 64658ada1f
commit d658cd4c6a
4 changed files with 27 additions and 3 deletions

View File

@ -1,3 +1,13 @@
1999-10-30 Mark Mitchell <mark@codesourcery.com>
* decl.c (pop_cp_function_context): Don't call free on a NULL
pointer.
* semantics.c: Include ggc.h.
(expand_body): Do garbage-collection after processing a template
function. Clear DECL_SAVED_TREE after generating RTL for a
function.
* Makefile.in (semantics.o): Depend on ggc.h.
1999-10-29 Mark Mitchell <mark@codesourcery.com>
* cp-tree.h (make_typename_type): Change prototype.

View File

@ -295,7 +295,7 @@ repo.o : repo.c $(CONFIG_H) $(CXX_TREE_H) $(srcdir)/../system.h \
$(srcdir)/../toplev.h $(srcdir)/../ggc.h
semantics.o: semantics.c $(CONFIG_H) $(CXX_TREE_H) lex.h \
$(srcdir)/../except.h $(srcdir)/../system.h $(srcdir)/../toplev.h \
$(srcdir)/../flags.h
$(srcdir)/../flags.h $(srcdir)/../ggc.h
dump.o: dump.c $(CONFIG_H) $(CXX_TREE_H) $(srcdir)/../system.h
#

View File

@ -14234,7 +14234,8 @@ static void
pop_cp_function_context (f)
struct function *f;
{
free (f->language);
if (f->language)
free (f->language);
f->language = 0;
}

View File

@ -32,6 +32,7 @@
#include "lex.h"
#include "toplev.h"
#include "flags.h"
#include "ggc.h"
/* There routines provide a modular interface to perform many parsing
operations. They may therefore be used during actual parsing, or
@ -2509,7 +2510,14 @@ expand_body (fn)
|| (DECL_LANG_SPECIFIC (fn)
&& DECL_TEMPLATE_INFO (fn)
&& uses_template_parms (DECL_TI_ARGS (fn))))
return;
{
/* Normally, collection only occurs in rest_of_compilation. So,
if we don't collect here, we never collect junk generated
during the processing of templates until we hit a
non-template function. */
ggc_collect ();
return;
}
/* There's no reason to do any of the work here if we're only doing
semantic analysis; this code just generates RTL. */
@ -2546,6 +2554,11 @@ expand_body (fn)
/* Generate code for the function. */
finish_function (lineno, 0);
/* We don't need the body any more. Allow it to be garbage
collected. We can't do this if we're going to dump everything. */
if (!flag_dump_translation_unit)
DECL_SAVED_TREE (fn) = NULL_TREE;
/* And restore the current source position. */
lineno = saved_lineno;
input_filename = saved_input_filename;