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
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 *);
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);
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);