aboutsummaryrefslogtreecommitdiff
path: root/gdb/objfiles.h
diff options
context:
space:
mode:
authorTom Tromey <tom@tromey.com>2019-11-01 16:06:37 -0600
committerTom Tromey <tom@tromey.com>2019-12-12 15:50:50 -0700
commitbda13cdcf0db4d9cee648bfa0bfc7f1a4415d2a7 (patch)
treea11e4629bd2cfa2b93099d1348b2e49697559fa2 /gdb/objfiles.h
parentac0ab1842de0e4522248ff9805c5c4e3267c8ae7 (diff)
downloadgdb-bda13cdcf0db4d9cee648bfa0bfc7f1a4415d2a7.zip
gdb-bda13cdcf0db4d9cee648bfa0bfc7f1a4415d2a7.tar.gz
gdb-bda13cdcf0db4d9cee648bfa0bfc7f1a4415d2a7.tar.bz2
Make the objfile constructor private
This changes the objfile constructor to be private, changing the callers to use a factory method. This isn't perhaps strictly needed for the goal of this series -- changing the container model of objfiles -- but is a nice symmetry. gdb/ChangeLog 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. Change-Id: I42e07bc80a88cf3322ace94ffe869ae5788bcb29
Diffstat (limited to 'gdb/objfiles.h')
-rw-r--r--gdb/objfiles.h12
1 files changed, 12 insertions, 0 deletions
diff --git a/gdb/objfiles.h b/gdb/objfiles.h
index 1601cfe..b5c04eb 100644
--- a/gdb/objfiles.h
+++ b/gdb/objfiles.h
@@ -394,7 +394,19 @@ private:
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);