+2019-12-12 Tom Tromey <tom@tromey.com>
+
+ * symfile.c (symbol_file_add_with_addrs): Use objfile::make.
+ * objfiles.h (struct objfile): Make constructor private.
+ <make>: New static method.
+ * jit.c (jit_object_close_impl): Update.
+
2019-12-12 Simon Marchi <simon.marchi@polymtl.ca>
* jit.c (jit_reader_try_read_symtab): Replace xmalloc/xfree with
priv_data = (jit_dbg_reader_data *) cb->priv_data;
- objfile = new struct objfile (NULL, "<< JIT compiled code >>",
- OBJF_NOT_FILENAME);
+ objfile = objfile::make (nullptr, "<< JIT compiled code >>",
+ OBJF_NOT_FILENAME);
objfile->per_bfd->gdbarch = target_gdbarch ();
j = NULL;
struct objfile
{
+private:
+
+ /* The only way to create an objfile is to call objfile::make. */
objfile (bfd *, const char *, objfile_flags);
+
+public:
+
+ /* Create an objfile. */
+ static objfile *make (bfd *bfd_, const char *name_, objfile_flags flags_)
+ {
+ return new objfile (bfd_, name_, flags_);
+ }
+
~objfile ();
DISABLE_COPY_AND_ASSIGN (objfile);
if (mainline)
flags |= OBJF_MAINLINE;
- objfile = new struct objfile (abfd, name, flags);
+ objfile = objfile::make (abfd, name, flags);
if (parent)
add_separate_debug_objfile (objfile, parent);