Make the objfile destructor private
[deliverable/binutils-gdb.git] / gdb / objfiles.c
index 0ee5720cf67bc671359db45e42a020728b7be359..a635f7783e6e9e545ae141bb3292592040bc1306 100644 (file)
@@ -553,6 +553,14 @@ objfile::make (bfd *bfd_, const char *name_, objfile_flags flags_,
   return result;
 }
 
+/* See objfiles.h.  */
+
+void
+objfile::unlink ()
+{
+  delete this;
+}
+
 /* Free all separate debug objfile of OBJFILE, but don't free OBJFILE
    itself.  */
 
@@ -564,7 +572,7 @@ free_objfile_separate_debug (struct objfile *objfile)
   for (child = objfile->separate_debug_objfile; child;)
     {
       struct objfile *next_child = child->separate_debug_objfile_link;
-      delete child;
+      child->unlink ();
       child = next_child;
     }
 }
@@ -687,7 +695,7 @@ free_all_objfiles (void)
     gdb_assert (so->objfile == NULL);
 
   for (objfile *objfile : current_program_space->objfiles_safe ())
-    delete objfile;
+    objfile->unlink ();
   clear_symtab_users (0);
 }
 \f
@@ -996,7 +1004,7 @@ objfile_purge_solibs (void)
         be soon.  */
 
       if (!(objf->flags & OBJF_USERLOADED) && (objf->flags & OBJF_SHARED))
-       delete objf;
+       objf->unlink ();
     }
 }
 
This page took 0.023522 seconds and 4 git commands to generate.