From 5b7d941b90d1a232dc144dc14850dd2fb63c35da Mon Sep 17 00:00:00 2001 From: Simon Marchi Date: Fri, 22 Jan 2021 12:21:09 -0500 Subject: gdb: add owner-related methods to struct type Add the following methods to struct type: * is_objfile_owned * set_owner (objfile and gdbarch overloads) * objfile and arch getters Rename the fields in main_type to ensure no other code accesses them directly. As usual, we can't make them actually private, but giving them the `m_` prefix will help making sure they are not accessed when not supposed to, by convention. Remove the TYPE_OWNER macro to ensure no code uses the type_owner struct directly. gdb/ChangeLog: * gdbtypes.h (TYPE_OBJFILE_OWNED): Adjust. (TYPE_OWNER): Remove. (TYPE_OBJFILE): Adjust. (struct main_type) : Rename to... : ... this. : Rename to... : ... this. (struct type) : New methods. (TYPE_ALLOC): Adjust. * gdbtypes.c (alloc_type): Adjust. (alloc_type_arch): Adjust. (alloc_type_copy): Adjust. (get_type_arch): Adjust. (smash_type): Adjust. (lookup_array_range_type): Adjust. (recursive_dump_type): Adjust. (copy_type_recursive): Adjust. * compile/compile-c-types.c (convert_func): Adjust. (convert_type_basic): Adjust. * compile/compile-cplus-types.c (compile_cplus_convert_func): Adjust. * language.c (language_arch_info::type_and_symbol::alloc_type_symbol): Adjust. Change-Id: I7f92e869d9f92e2402a3d3007dd0832e05aa6ac8 --- gdb/language.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'gdb/language.c') diff --git a/gdb/language.c b/gdb/language.c index 1770ba1..d4b8491 100644 --- a/gdb/language.c +++ b/gdb/language.c @@ -1037,7 +1037,7 @@ language_arch_info::type_and_symbol::alloc_type_symbol struct symbol *symbol; struct gdbarch *gdbarch; gdb_assert (!TYPE_OBJFILE_OWNED (type)); - gdbarch = TYPE_OWNER (type).gdbarch; + gdbarch = type->arch (); symbol = new (gdbarch_obstack (gdbarch)) struct symbol (); symbol->m_name = type->name (); symbol->set_language (lang, nullptr); -- cgit v1.1