+2019-05-08 Tom Tromey <tom@tromey.com>
+
+ * objc-lang.c (objc_objfile_data): Change type.
+ (find_methods): Update.
+ (_initialize_objc_lang): Remove.
+
2019-05-08 Tom Tromey <tom@tromey.com>
* stabsread.c (rs6000_builtin_type_data): Change type.
CORE_ADDR imp;
};
-static const struct objfile_data *objc_objfile_data;
+static const struct objfile_key<unsigned int> objc_objfile_data;
/* Lookup a structure type named "struct NAME", visible in lexical
block BLOCK. If NOERR is nonzero, return zero if NAME is not
unsigned int objfile_csym = 0;
- objc_csym = (unsigned int *) objfile_data (objfile, objc_objfile_data);
+ objc_csym = objc_objfile_data.get (objfile);
if (objc_csym != NULL && *objc_csym == 0)
/* There are no ObjC symbols in this objfile. Skip it entirely. */
continue;
}
if (objc_csym == NULL)
- {
- objc_csym = XOBNEW (&objfile->objfile_obstack, unsigned int);
- *objc_csym = objfile_csym;
- set_objfile_data (objfile, objc_objfile_data, objc_csym);
- }
+ objc_csym = objc_objfile_data.emplace (objfile, objfile_csym);
else
/* Count of ObjC methods in this objfile should be constant. */
gdb_assert (*objc_csym == objfile_csym);
return 1;
return 0;
}
-
-void
-_initialize_objc_lang (void)
-{
- objc_objfile_data = register_objfile_data ();
-}