From e947a8482ac8ea529869c15b6949e4f19272c747 Mon Sep 17 00:00:00 2001 From: Tom Tromey Date: Wed, 23 Sep 2020 09:32:54 -0600 Subject: 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 * 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. --- gdb/compile/compile-object-load.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) (limited to 'gdb/compile/compile-object-load.c') diff --git a/gdb/compile/compile-object-load.c b/gdb/compile/compile-object-load.c index 2f41607..dff10fe 100644 --- a/gdb/compile/compile-object-load.c +++ b/gdb/compile/compile-object-load.c @@ -582,7 +582,7 @@ store_regs (struct type *regs_type, CORE_ADDR regs_base) COMPILE_I_PRINT_ADDRESS_SCOPE when COMPILE_I_PRINT_VALUE_SCOPE should have been used instead. */ -struct compile_module * +compile_module_up compile_object_load (const compile_file_names &file_names, enum compile_i_scope_types scope, void *scope_data) { @@ -594,7 +594,6 @@ compile_object_load (const compile_file_names &file_names, long storage_needed; asymbol **symbol_table, **symp; long number_of_symbols, missing_symbols; - struct compile_module *retval; struct type *regs_type, *out_value_type = NULL; char **matching; struct objfile *objfile; @@ -790,7 +789,7 @@ compile_object_load (const compile_file_names &file_names, paddress (target_gdbarch (), out_value_addr)); } - retval = XNEW (struct compile_module); + compile_module_up retval (new struct compile_module); retval->objfile = objfile_holder.release (); retval->source_file = xstrdup (file_names.source_file ()); retval->func_sym = func_sym; -- cgit v1.1