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<objfile> (result),
+ current_program_space->add_objfile (std::unique_ptr<objfile> (result),
parent);
/* Rebuild section map next time we need it. */
remove it from the program space's list. In some cases, you may
need to hold a reference to an objfile that is independent of its
existence on the program space's list; for this case, the
- destructor must be public so that shared_ptr can reference
+ destructor must be public so that unique_ptr can reference
it. */
~objfile ();
/* See progspace.h. */
void
-program_space::add_objfile (std::shared_ptr<objfile> &&objfile,
+program_space::add_objfile (std::unique_ptr<objfile> &&objfile,
struct objfile *before)
{
if (before == nullptr)
else
{
auto iter = std::find_if (objfiles_list.begin (), objfiles_list.end (),
- [=] (const std::shared_ptr<::objfile> &objf)
+ [=] (const std::unique_ptr<::objfile> &objf)
{
return objf.get () == before;
});
reinit_frame_cache ();
auto iter = std::find_if (objfiles_list.begin (), objfiles_list.end (),
- [=] (const std::shared_ptr<::objfile> &objf)
+ [=] (const std::unique_ptr<::objfile> &objf)
{
return objf.get () == objfile;
});
struct address_space_data;
struct so_list;
-typedef std::list<std::shared_ptr<objfile>> objfile_list;
+typedef std::list<std::unique_ptr<objfile>> objfile_list;
-/* An iterator that wraps an iterator over std::shared_ptr<objfile>,
+/* An iterator that wraps an iterator over std::unique_ptr<objfile>,
and dereferences the returned object. This is useful for iterating
over a list of shared pointers and returning raw pointers -- which
helped avoid touching a lot of code when changing how objfiles are
/* Add OBJFILE to the list of objfiles, putting it just before
BEFORE. If BEFORE is nullptr, it will go at the end of the
list. */
- void add_objfile (std::shared_ptr<objfile> &&objfile,
+ void add_objfile (std::unique_ptr<objfile> &&objfile,
struct objfile *before);
/* Remove OBJFILE from the list of objfiles. */
struct objfile *symfile_object_file = NULL;
/* All known objfiles are kept in a linked list. */
- std::list<std::shared_ptr<objfile>> objfiles_list;
+ std::list<std::unique_ptr<objfile>> objfiles_list;
/* List of shared objects mapped into this space. Managed by
solib.c. */