aboutsummaryrefslogtreecommitdiff
path: root/gdb/compile
diff options
context:
space:
mode:
authorTom Tromey <tom@tromey.com>2017-11-01 18:51:15 -0600
committerTom Tromey <tom@tromey.com>2017-11-04 10:27:18 -0600
commited2b3126d1828d55d57880c6b6045a4e58c05cde (patch)
tree20e7536b313e0fd676548fea0e253c2290988608 /gdb/compile
parent7f6743fd09d0f3188dd9dcdf31acf81131f9bf1f (diff)
downloadgdb-ed2b3126d1828d55d57880c6b6045a4e58c05cde.zip
gdb-ed2b3126d1828d55d57880c6b6045a4e58c05cde.tar.gz
gdb-ed2b3126d1828d55d57880c6b6045a4e58c05cde.tar.bz2
Remove make_cleanup_free_objfile
This replaces make_cleanup_free_objfile with std::unique_ptr. gdb/ChangeLog 2017-11-04 Tom Tromey <tom@tromey.com> * objfiles.c (do_free_objfile_cleanup): Remove. * compile/compile-object-load.c (compile_object_load): Update. * objfiles.h (make_cleanup_free_objfile): Remove.
Diffstat (limited to 'gdb/compile')
-rw-r--r--gdb/compile/compile-object-load.c13
1 files changed, 6 insertions, 7 deletions
diff --git a/gdb/compile/compile-object-load.c b/gdb/compile/compile-object-load.c
index 8e55d3c..e69fbc6 100644
--- a/gdb/compile/compile-object-load.c
+++ b/gdb/compile/compile-object-load.c
@@ -606,7 +606,7 @@ struct compile_module *
compile_object_load (const compile_file_names &file_names,
enum compile_i_scope_types scope, void *scope_data)
{
- struct cleanup *cleanups, *cleanups_free_objfile;
+ struct cleanup *cleanups;
struct setup_sections_data setup_sections_data;
CORE_ADDR addr, regs_addr, out_value_addr = 0;
struct symbol *func_sym;
@@ -656,9 +656,10 @@ compile_object_load (const compile_file_names &file_names,
/* SYMFILE_VERBOSE is not passed even if FROM_TTY, user is not interested in
"Reading symbols from ..." message for automatically generated file. */
- objfile = symbol_file_add_from_bfd (abfd.get (), filename.get (),
- 0, NULL, 0, NULL);
- cleanups_free_objfile = make_cleanup_free_objfile (objfile);
+ std::unique_ptr<struct objfile> objfile_holder
+ (symbol_file_add_from_bfd (abfd.get (), filename.get (),
+ 0, NULL, 0, NULL));
+ objfile = objfile_holder.get ();
func_sym = lookup_global_symbol_from_objfile (objfile,
GCC_FE_WRAPPER_FUNCTION,
@@ -812,10 +813,8 @@ compile_object_load (const compile_file_names &file_names,
paddress (target_gdbarch (), out_value_addr));
}
- discard_cleanups (cleanups_free_objfile);
-
retval = XNEW (struct compile_module);
- retval->objfile = objfile;
+ retval->objfile = objfile_holder.release ();
retval->source_file = xstrdup (file_names.source_file ());
retval->func_sym = func_sym;
retval->regs_addr = regs_addr;