Introduce and use compile_module_up

This introduces compile_module_up, a unique pointer for
compile_module, and changes a few spots to use it.

gdb/ChangeLog
2020-09-23  Tom Tromey  <tom@tromey.com>

	* compile/compile.c (eval_compile_command): Update.
	* compile/compile-object-run.h (compile_object_run): Take a
	compile_module_up.
	* compile/compile-object-run.c (compile_object_run): Take a
	compile_module_up.
	* compile/compile-object-load.h (struct compile_module): Add
	constructor, destructor.
	(compile_module_up): New typedef.
	(compile_object_load): Return compile_object_up.
	* compile/compile-object-load.c (compile_object_load): Return
	compile_module_up.
This commit is contained in:
Tom Tromey 2020-09-23 09:32:54 -06:00
parent 0dbf6ee6a0
commit e947a8482a
6 changed files with 32 additions and 12 deletions

View file

@ -131,7 +131,7 @@ create_copied_type_recursive (objfile *objfile, type *func_type)
longer touch MODULE's memory after this function has been called. */
void
compile_object_run (struct compile_module *module)
compile_object_run (compile_module_up &&module)
{
struct value *func_val;
struct do_module_cleanup *data;
@ -152,8 +152,6 @@ compile_object_run (struct compile_module *module)
data->munmap_list_head = module->munmap_list_head;
xfree (module->source_file);
xfree (module);
module = NULL;
try
{