aboutsummaryrefslogtreecommitdiff
path: root/gdb
diff options
context:
space:
mode:
authorTom Tromey <tom@tromey.com>2019-05-02 16:13:50 -0600
committerTom Tromey <tom@tromey.com>2019-05-08 16:01:56 -0600
commit7a1021395e0ef7a92e1653533b753a2221396015 (patch)
tree6292896eccc7379a54733424ad4842f910fb2644 /gdb
parent924d79e23306bb85fd1dd78564f4779fd3aeec56 (diff)
downloadgdb-7a1021395e0ef7a92e1653533b753a2221396015.zip
gdb-7a1021395e0ef7a92e1653533b753a2221396015.tar.gz
gdb-7a1021395e0ef7a92e1653533b753a2221396015.tar.bz2
Convert gdbtypes.c to type-safe registry API
This changes gdbtypes.c to use the type-safe registry API. gdb/ChangeLog 2019-05-08 Tom Tromey <tom@tromey.com> * gdbtypes.c (objfile_type_data): Change type. (objfile_type, _initialize_gdbtypes): Update.
Diffstat (limited to 'gdb')
-rw-r--r--gdb/ChangeLog5
-rw-r--r--gdb/gdbtypes.c10
2 files changed, 10 insertions, 5 deletions
diff --git a/gdb/ChangeLog b/gdb/ChangeLog
index 11a973d..5b0a9fd 100644
--- a/gdb/ChangeLog
+++ b/gdb/ChangeLog
@@ -1,5 +1,10 @@
2019-05-08 Tom Tromey <tom@tromey.com>
+ * gdbtypes.c (objfile_type_data): Change type.
+ (objfile_type, _initialize_gdbtypes): Update.
+
+2019-05-08 Tom Tromey <tom@tromey.com>
+
* dwarf2-frame.c (dwarf2_frame_objfile_data): Change type.
(dwarf2_frame_find_fde, dwarf2_build_frame_info)
(_initialize_dwarf2_frame): Update.
diff --git a/gdb/gdbtypes.c b/gdb/gdbtypes.c
index b3424d8..59456f9 100644
--- a/gdb/gdbtypes.c
+++ b/gdb/gdbtypes.c
@@ -5458,14 +5458,15 @@ gdbtypes_post_init (struct gdbarch *gdbarch)
/* This set of objfile-based types is intended to be used by symbol
readers as basic types. */
-static const struct objfile_data *objfile_type_data;
+static const struct objfile_key<struct objfile_type,
+ gdb::noop_deleter<struct objfile_type>>
+ objfile_type_data;
const struct objfile_type *
objfile_type (struct objfile *objfile)
{
struct gdbarch *gdbarch;
- struct objfile_type *objfile_type
- = (struct objfile_type *) objfile_data (objfile, objfile_type_data);
+ struct objfile_type *objfile_type = objfile_type_data.get (objfile);
if (objfile_type)
return objfile_type;
@@ -5570,7 +5571,7 @@ objfile_type (struct objfile *objfile)
= init_integer_type (objfile, gdbarch_addr_bit (gdbarch), 1,
"__CORE_ADDR");
- set_objfile_data (objfile, objfile_type_data, objfile_type);
+ objfile_type_data.set (objfile, objfile_type);
return objfile_type;
}
@@ -5578,7 +5579,6 @@ void
_initialize_gdbtypes (void)
{
gdbtypes_data = gdbarch_data_register_post_init (gdbtypes_post_init);
- objfile_type_data = register_objfile_data ();
add_setshow_zuinteger_cmd ("overload", no_class, &overload_debug,
_("Set debugging of C++ overloading."),