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.
This commit is contained in:
Tom Tromey 2019-05-02 16:13:50 -06:00
parent 924d79e233
commit 7a1021395e
2 changed files with 10 additions and 5 deletions

View File

@ -1,3 +1,8 @@
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.

View File

@ -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."),