gdb: Convert language la_class_name_from_physname field to a method

This commit changes the language_data::la_class_name_from_physname function
pointer member variable into a member function of language_defn.

There should be no user visible changes after this commit.

gdb/ChangeLog:

	* ada-lang.c (ada_language_data) Delete
	la_class_name_from_physname initializer.
	* c-lang.c (c_language_data): Likewise.
	(cplus_language_data): Likewise.
	(cplus_language::class_name_from_physname): New member function.
	(asm_language_data): Delete la_class_name_from_physname
	initializer.
	(minimal_language_data): Likewise.
	* d-lang.c (d_language_data): Likewise.
	* dwarf2/read.c (guess_partial_die_structure_name): Update to call
	method on language_defn class.
	(guess_full_die_structure_name): Likewise.
	* f-lang.c (f_language_data): Delete la_class_name_from_physname
	initializer.
	* go-lang.c (go_language_data): Likewise.
	* language.c (language_class_name_from_physname): Delete.
	(unk_lang_class_name): Delete.
	(unknown_language_data): Delete la_class_name_from_physname
	initializer.
	(auto_language_data): Likewise.
	* language.h (language_data): Delete la_class_name_from_physname
	field.
	(language_defn::class_name_from_physname): New function.
	(language_class_name_from_physname): Delete declaration.
	* m2-lang.c (m2_language_data): Delete la_class_name_from_physname
	initializer.
	* objc-lang.c (objc_language_data): Likewise.
	* opencl-lang.c (opencl_language_data): Likewise.
	* p-lang.c (pascal_language_data): Likewise.
	* rust-lang.c (rust_language_data): Likewise.
This commit is contained in:
Andrew Burgess 2020-06-01 10:53:05 +01:00
parent de54374205
commit eff93b4d48
14 changed files with 49 additions and 55 deletions

View File

@ -1,3 +1,36 @@
2020-06-17 Andrew Burgess <andrew.burgess@embecosm.com>
* ada-lang.c (ada_language_data) Delete
la_class_name_from_physname initializer.
* c-lang.c (c_language_data): Likewise.
(cplus_language_data): Likewise.
(cplus_language::class_name_from_physname): New member function.
(asm_language_data): Delete la_class_name_from_physname
initializer.
(minimal_language_data): Likewise.
* d-lang.c (d_language_data): Likewise.
* dwarf2/read.c (guess_partial_die_structure_name): Update to call
method on language_defn class.
(guess_full_die_structure_name): Likewise.
* f-lang.c (f_language_data): Delete la_class_name_from_physname
initializer.
* go-lang.c (go_language_data): Likewise.
* language.c (language_class_name_from_physname): Delete.
(unk_lang_class_name): Delete.
(unknown_language_data): Delete la_class_name_from_physname
initializer.
(auto_language_data): Likewise.
* language.h (language_data): Delete la_class_name_from_physname
field.
(language_defn::class_name_from_physname): New function.
(language_class_name_from_physname): Delete declaration.
* m2-lang.c (m2_language_data): Delete la_class_name_from_physname
initializer.
* objc-lang.c (objc_language_data): Likewise.
* opencl-lang.c (opencl_language_data): Likewise.
* p-lang.c (pascal_language_data): Likewise.
* rust-lang.c (rust_language_data): Likewise.
2020-06-16 Tom Tromey <tom@tromey.com>
* tui/tui-data.h (STATUS_NAME): New macro.

View File

@ -13914,8 +13914,6 @@ extern const struct language_data ada_language_data =
NULL, /* name_of_this */
true, /* la_store_sym_names_in_linkage_form_p */
ada_lookup_symbol_nonlocal, /* Looking up non-local symbols. */
NULL, /* Language specific
class_name_from_physname */
ada_op_print_tab, /* expression operators for printing */
0, /* c-style arrays */
1, /* String lower bound */

View File

@ -911,8 +911,6 @@ extern const struct language_data c_language_data =
NULL, /* name_of_this */
true, /* la_store_sym_names_in_linkage_form_p */
basic_lookup_symbol_nonlocal, /* lookup_symbol_nonlocal */
NULL, /* Language specific
class_name_from_physname */
c_op_print_tab, /* expression operators for printing */
1, /* c-style arrays */
0, /* String lower bound */
@ -1019,8 +1017,6 @@ extern const struct language_data cplus_language_data =
"this", /* name_of_this */
false, /* la_store_sym_names_in_linkage_form_p */
cp_lookup_symbol_nonlocal, /* lookup_symbol_nonlocal */
cp_class_name_from_physname, /* Language specific
class_name_from_physname */
c_op_print_tab, /* expression operators for printing */
1, /* c-style arrays */
0, /* String lower bound */
@ -1163,6 +1159,13 @@ public:
{
return cplus_skip_trampoline (fi, pc);
}
/* See language.h. */
char *class_name_from_physname (const char *physname) const override
{
return cp_class_name_from_physname (physname);
}
};
/* The single instance of the C++ language class. */
@ -1198,8 +1201,6 @@ extern const struct language_data asm_language_data =
NULL, /* name_of_this */
true, /* la_store_sym_names_in_linkage_form_p */
basic_lookup_symbol_nonlocal, /* lookup_symbol_nonlocal */
NULL, /* Language specific
class_name_from_physname */
c_op_print_tab, /* expression operators for printing */
1, /* c-style arrays */
0, /* String lower bound */
@ -1271,8 +1272,6 @@ extern const struct language_data minimal_language_data =
NULL, /* name_of_this */
true, /* la_store_sym_names_in_linkage_form_p */
basic_lookup_symbol_nonlocal, /* lookup_symbol_nonlocal */
NULL, /* Language specific
class_name_from_physname */
c_op_print_tab, /* expression operators for printing */
1, /* c-style arrays */
0, /* String lower bound */

View File

@ -154,8 +154,6 @@ extern const struct language_data d_language_data =
"this",
false, /* la_store_sym_names_in_linkage_form_p */
d_lookup_symbol_nonlocal,
NULL, /* Language specific
class_name_from_physname. */
d_op_print_tab, /* Expression operators for printing. */
1, /* C-style arrays. */
0, /* String lower bound. */

View File

@ -18874,8 +18874,8 @@ guess_partial_die_structure_name (struct partial_die_info *struct_pdi,
&& child_pdi->linkage_name != NULL)
{
gdb::unique_xmalloc_ptr<char> actual_class_name
(language_class_name_from_physname (cu->language_defn,
child_pdi->linkage_name));
(cu->language_defn->class_name_from_physname
(child_pdi->linkage_name));
if (actual_class_name != NULL)
{
struct objfile *objfile = cu->per_objfile->objfile;
@ -21715,8 +21715,7 @@ guess_full_die_structure_name (struct die_info *die, struct dwarf2_cu *cu)
if (linkage_name != NULL)
{
gdb::unique_xmalloc_ptr<char> actual_name
(language_class_name_from_physname (cu->language_defn,
linkage_name));
(cu->language_defn->class_name_from_physname (linkage_name));
const char *name = NULL;
if (actual_name != NULL)

View File

@ -614,8 +614,6 @@ extern const struct language_data f_language_data =
NULL, /* name_of_this */
false, /* la_store_sym_names_in_linkage_form_p */
cp_lookup_symbol_nonlocal, /* lookup_symbol_nonlocal */
NULL, /* Language specific
class_name_from_physname */
f_op_print_tab, /* expression operators for printing */
0, /* arrays are first-class (not c-style) */
1, /* String lower bound */

View File

@ -539,8 +539,6 @@ extern const struct language_data go_language_data =
NULL, /* name_of_this */
false, /* la_store_sym_names_in_linkage_form_p */
basic_lookup_symbol_nonlocal,
NULL, /* Language specific
class_name_from_physname. */
go_op_print_tab, /* Expression operators for printing. */
1, /* C-style arrays. */
0, /* String lower bound. */

View File

@ -589,16 +589,6 @@ language_demangle (const struct language_defn *current_language,
return NULL;
}
/* Return class name from physname or NULL. */
char *
language_class_name_from_physname (const struct language_defn *lang,
const char *physname)
{
if (lang != NULL && lang->la_class_name_from_physname)
return lang->la_class_name_from_physname (physname);
return NULL;
}
/* Return information about whether TYPE should be passed
(and returned) by reference at the language level. */
@ -739,11 +729,6 @@ unk_lang_value_print (struct value *val, struct ui_file *stream,
"function unk_lang_value_print called."));
}
static char *unk_lang_class_name (const char *mangled)
{
return NULL;
}
static const struct op_print unk_op_print_tab[] =
{
{NULL, OP_NULL, PREC_NULL, 0}
@ -783,8 +768,6 @@ extern const struct language_data unknown_language_data =
"this", /* name_of_this */
true, /* store_sym_names_in_linkage_form_p */
basic_lookup_symbol_nonlocal, /* lookup_symbol_nonlocal */
unk_lang_class_name, /* Language specific
class_name_from_physname */
unk_op_print_tab, /* expression operators for printing */
1, /* c-style arrays */
0, /* String lower bound */
@ -860,8 +843,6 @@ extern const struct language_data auto_language_data =
"this", /* name_of_this */
false, /* store_sym_names_in_linkage_form_p */
basic_lookup_symbol_nonlocal, /* lookup_symbol_nonlocal */
unk_lang_class_name, /* Language specific
class_name_from_physname */
unk_op_print_tab, /* expression operators for printing */
1, /* c-style arrays */
0, /* String lower bound */

View File

@ -304,9 +304,6 @@ struct language_data
const struct block *,
const domain_enum);
/* Return class name of a mangled method name or NULL. */
char *(*la_class_name_from_physname) (const char *physname);
/* Table for printing expressions. */
const struct op_print *la_op_print_tab;
@ -523,6 +520,12 @@ struct language_defn : language_data
return (CORE_ADDR) 0;
}
/* Return class name of a mangled method name or NULL. */
virtual char *class_name_from_physname (const char *physname) const
{
return nullptr;
}
/* List of all known languages. */
static const struct language_defn *languages[nr_languages];
};
@ -677,10 +680,6 @@ extern CORE_ADDR skip_language_trampoline (struct frame_info *, CORE_ADDR pc);
extern char *language_demangle (const struct language_defn *current_language,
const char *mangled, int options);
/* Return class name from physname, or NULL. */
extern char *language_class_name_from_physname (const struct language_defn *,
const char *physname);
/* Splitting strings into words. */
extern const char *default_word_break_characters (void);

View File

@ -373,8 +373,6 @@ extern const struct language_data m2_language_data =
NULL, /* name_of_this */
false, /* la_store_sym_names_in_linkage_form_p */
basic_lookup_symbol_nonlocal, /* lookup_symbol_nonlocal */
NULL, /* Language specific
class_name_from_physname */
m2_op_print_tab, /* expression operators for printing */
0, /* arrays are first-class (not c-style) */
0, /* String lower bound */

View File

@ -348,8 +348,6 @@ extern const struct language_data objc_language_data =
"self", /* name_of_this */
false, /* la_store_sym_names_in_linkage_form_p */
basic_lookup_symbol_nonlocal, /* lookup_symbol_nonlocal */
NULL, /* Language specific
class_name_from_physname */
objc_op_print_tab, /* Expression operators for printing */
1, /* C-style arrays */
0, /* String lower bound */

View File

@ -1027,8 +1027,6 @@ extern const struct language_data opencl_language_data =
NULL, /* name_of_this */
false, /* la_store_sym_names_in_linkage_form_p */
basic_lookup_symbol_nonlocal, /* lookup_symbol_nonlocal */
NULL, /* Language specific
class_name_from_physname */
c_op_print_tab, /* expression operators for printing */
1, /* c-style arrays */
0, /* String lower bound */

View File

@ -404,7 +404,6 @@ extern const struct language_data pascal_language_data =
"this", /* name_of_this */
false, /* la_store_sym_names_in_linkage_form_p */
basic_lookup_symbol_nonlocal, /* lookup_symbol_nonlocal */
NULL, /* Language specific class_name_from_physname */
pascal_op_print_tab, /* expression operators for printing */
1, /* c-style arrays */
0, /* String lower bound */

View File

@ -2059,8 +2059,6 @@ extern const struct language_data rust_language_data =
NULL, /* name_of_this */
false, /* la_store_sym_names_in_linkage_form_p */
rust_lookup_symbol_nonlocal, /* lookup_symbol_nonlocal */
NULL, /* Language specific
class_name_from_physname */
c_op_print_tab, /* expression operators for printing */
1, /* c-style arrays */
0, /* String lower bound */