Remove MULTI_OBJFILE_P
[deliverable/binutils-gdb.git] / gdb / objfiles.h
index 1601cfe591f0b4d7031555e9d67f0b2faac0dd7b..0656cfe4a12f1f6e0280b804a49573e18c48c41c 100644 (file)
@@ -394,9 +394,24 @@ private:
 
 struct objfile
 {
+private:
+
+  /* The only way to create an objfile is to call objfile::make.  */
   objfile (bfd *, const char *, objfile_flags);
+
+  /* The only way to free an objfile is via 'unlink'.  */
   ~objfile ();
 
+public:
+
+  /* Create an objfile.  */
+  static objfile *make (bfd *bfd_, const char *name_, objfile_flags flags_,
+                       objfile *parent = nullptr);
+
+  /* Remove an objfile from the current program space, and free
+     it.  */
+  void unlink ();
+
   DISABLE_COPY_AND_ASSIGN (objfile);
 
   /* A range adapter that makes it possible to iterate over all
@@ -627,6 +642,20 @@ struct objfile
   htab_up static_links;
 };
 
+/* A deleter for objfile.  */
+
+struct objfile_deleter
+{
+  void operator() (objfile *ptr) const
+  {
+    ptr->unlink ();
+  }
+};
+
+/* A unique pointer that holds an objfile.  */
+
+typedef std::unique_ptr<objfile, objfile_deleter> objfile_up;
+
 /* Declarations for functions defined in objfiles.c */
 
 extern struct gdbarch *get_objfile_arch (const struct objfile *);
@@ -637,8 +666,6 @@ extern CORE_ADDR entry_point_address (void);
 
 extern void build_objfile_section_table (struct objfile *);
 
-extern void add_separate_debug_objfile (struct objfile *, struct objfile *);
-
 extern void free_objfile_separate_debug (struct objfile *);
 
 extern void free_all_objfiles (void);
@@ -746,10 +773,6 @@ extern void default_iterate_over_objfiles_in_search_order
    uninitialized section index.  */
 #define SECT_OFF_BSS(objfile) (objfile)->sect_index_bss
 
-/* Answer whether there is more than one object file loaded.  */
-
-#define MULTI_OBJFILE_P() (object_files && object_files->next)
-
 /* Reset the per-BFD storage area on OBJ.  */
 
 void set_objfile_per_bfd (struct objfile *obj);
This page took 0.026974 seconds and 4 git commands to generate.