ubsan: nds32: left shift cannot be represented in type 'int'
[deliverable/binutils-gdb.git] / gdb / objfiles.c
index 31265c1653d944e32c9a618faf7e97b22e9a4056..81e82124297f088653574fe0da59f55f64189163 100644 (file)
@@ -486,7 +486,10 @@ objfile::make (bfd *bfd_, const char *name_, objfile_flags flags_,
   if (parent != nullptr)
     add_separate_debug_objfile (result, parent);
 
-  current_program_space->add_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),
+                                     parent);
 
   /* Rebuild section map next time we need it.  */
   get_objfile_pspace_data (current_program_space)->new_objfiles_available = 1;
@@ -500,7 +503,6 @@ void
 objfile::unlink ()
 {
   current_program_space->remove_objfile (this);
-  delete this;
 }
 
 /* Free all separate debug objfile of OBJFILE, but don't free OBJFILE
@@ -618,21 +620,6 @@ objfile::~objfile ()
   get_objfile_pspace_data (pspace)->section_map_dirty = 1;
 }
 
-/* Free all the object files at once and clean up their users.  */
-
-void
-free_all_objfiles (void)
-{
-  struct so_list *so;
-
-  /* Any objfile reference would become stale.  */
-  for (so = master_so_list (); so; so = so->next)
-    gdb_assert (so->objfile == NULL);
-
-  for (objfile *objfile : current_program_space->objfiles_safe ())
-    objfile->unlink ();
-  clear_symtab_users (0);
-}
 \f
 /* A helper function for objfile_relocate1 that relocates a single
    symbol.  */
This page took 0.024545 seconds and 4 git commands to generate.