gdb: Convert language la_print_typedef field to a method

This commit changes the language_data::la_print_typedef 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_print_typedef
	initializer.
	(ada_language::print_typedef): New member function.
	* c-lang.c (c_language_data): Delete la_print_typedef initializer.
	(cplus_language_data): Likewise.
	(asm_language_data): Likewise.
	(minimal_language_data): Likewise.
	* d-lang.c (d_language_data): Likewise.
	* f-lang.c (f_language_data): Likewise.
	(f_language::print_typedef): New member function.
	* go-lang.c (go_language_data): Delete la_print_typedef
	initializer.
	* language.c (language_defn::print_typedef): Define member
	function.
	(unknown_language_data): Delete la_print_typedef initializer.
	(unknown_language::print_typedef): New member function.
	(auto_language_data): Delete la_print_typedef initializer.
	(auto_language::print_typedef): New member function.
	* language.h (language_data): Delete la_print_typedef field.
	(language_defn::print_typedef): Declare new member function.
	(LA_PRINT_TYPEDEF): Update call to print_typedef.
	(default_print_typedef): Delete declaration.
	* m2-lang.c (m2_language_data): Delete la_print_typedef
	initializer.
	(m2_language::print_typedef): New member function.
	* objc-lang.c (objc_language_data): Delete la_print_typedef
	initializer.
	* opencl-lang.c (opencl_language_data): Likewise.
	* p-lang.c (pascal_language_data): Likewise.
	(pascal_language::print_typedef): New member function.
	* rust-lang.c (rust_print_typedef): Delete function,
	implementation moved to rust_language::print_typedef.
	(rust_language): Delete la_print_typedef initializer.
	(rust_language::print_typedef): New member function,
	implementation from rust_print_typedef.
	* typeprint.c (default_print_typedef): Delete.
This commit is contained in:
Andrew Burgess
2020-06-18 21:38:50 +01:00
parent d711ee67ac
commit 4ffc13fb0e
14 changed files with 118 additions and 51 deletions

View File

@@ -225,13 +225,6 @@ struct language_data
const struct exp_descriptor *la_exp_desc;
/* Print a typedef using syntax appropriate for this language.
TYPE is the underlying type. NEW_SYMBOL is the symbol naming
the type. STREAM is the output stream on which to print. */
void (*la_print_typedef) (struct type *type, struct symbol *new_symbol,
struct ui_file *stream);
/* Now come some hooks for lookup_symbol. */
/* If this is non-NULL, specifies the name that of the implicit
@@ -552,6 +545,14 @@ struct language_defn : language_data
const char *encoding, int force_ellipses,
const struct value_print_options *options) const;
/* Print a typedef using syntax appropriate for this language.
TYPE is the underlying type. NEW_SYMBOL is the symbol naming
the type. STREAM is the output stream on which to print. */
virtual void print_typedef (struct type *type, struct symbol *new_symbol,
struct ui_file *stream) const;
protected:
/* This is the overridable part of the GET_SYMBOL_NAME_MATCHER method.
@@ -648,7 +649,7 @@ extern enum language set_language (enum language);
(current_language->print_type(type,varstring,stream,show,level,flags))
#define LA_PRINT_TYPEDEF(type,new_symbol,stream) \
(current_language->la_print_typedef(type,new_symbol,stream))
(current_language->print_typedef (type,new_symbol,stream))
#define LA_VALUE_PRINT(val,stream,options) \
(current_language->value_print (val,stream,options))
@@ -715,10 +716,6 @@ extern char *language_demangle (const struct language_defn *current_language,
(and returned) by reference at the language level. */
struct language_pass_by_ref_info language_pass_by_reference (struct type *type);
/* The default implementation of la_print_typedef. */
void default_print_typedef (struct type *type, struct symbol *new_symbol,
struct ui_file *stream);
void c_get_string (struct value *value,
gdb::unique_xmalloc_ptr<gdb_byte> *buffer,
int *length, struct type **char_type,