From e2904e1ff0b0158cf6d8d335ca3f80ff7dc9eb6c Mon Sep 17 00:00:00 2001 From: Tom Tromey Date: Sat, 21 May 2022 09:50:13 -0600 Subject: Use unique_ptr for objfiles A while back, I changed objfiles to be held via a shared_ptr. The idea at the time was that this was a step toward writing to the index cache in the background, and this would let gdb keep a reference alive to do so. However, since then we've rewritten the DWARF reader, and the new index can do this without requiring a shared pointer -- in fact there are patches pending to implement this. This patch switches objfile management to unique_ptr, which makes more sense now. Regression tested on x86-64 Fedora 34. --- gdb/objfiles.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) (limited to 'gdb/objfiles.c') diff --git a/gdb/objfiles.c b/gdb/objfiles.c index 80f68fd..60d8aa5 100644 --- a/gdb/objfiles.c +++ b/gdb/objfiles.c @@ -468,9 +468,7 @@ objfile::make (bfd *bfd_, const char *name_, objfile_flags flags_, if (parent != nullptr) add_separate_debug_objfile (result, parent); - /* Using std::make_shared might be a bit nicer here, but that would - require making the constructor public. */ - current_program_space->add_objfile (std::shared_ptr (result), + current_program_space->add_objfile (std::unique_ptr (result), parent); /* Rebuild section map next time we need it. */ -- cgit v1.1