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:
parent
d711ee67ac
commit
4ffc13fb0e
@ -1,3 +1,42 @@
|
||||
2020-06-23 Andrew Burgess <andrew.burgess@embecosm.com>
|
||||
|
||||
* 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.
|
||||
|
||||
2020-06-23 Andrew Burgess <andrew.burgess@embecosm.com>
|
||||
|
||||
* ada-lang.c (ada_language_data): Delete la_printstr initializer.
|
||||
|
@ -13681,7 +13681,6 @@ extern const struct language_data ada_language_data =
|
||||
macro_expansion_no,
|
||||
ada_extensions,
|
||||
&ada_exp_descriptor,
|
||||
ada_print_typedef, /* Print a typedef using appropriate syntax */
|
||||
NULL, /* name_of_this */
|
||||
true, /* la_store_sym_names_in_linkage_form_p */
|
||||
ada_op_print_tab, /* expression operators for printing */
|
||||
@ -14132,6 +14131,14 @@ public:
|
||||
force_ellipses, options);
|
||||
}
|
||||
|
||||
/* See language.h. */
|
||||
|
||||
void print_typedef (struct type *type, struct symbol *new_symbol,
|
||||
struct ui_file *stream) const override
|
||||
{
|
||||
ada_print_typedef (type, new_symbol, stream);
|
||||
}
|
||||
|
||||
protected:
|
||||
/* See language.h. */
|
||||
|
||||
|
@ -889,7 +889,6 @@ extern const struct language_data c_language_data =
|
||||
macro_expansion_c,
|
||||
c_extensions,
|
||||
&exp_descriptor_c,
|
||||
c_print_typedef, /* Print a typedef using appropriate syntax */
|
||||
NULL, /* name_of_this */
|
||||
true, /* la_store_sym_names_in_linkage_form_p */
|
||||
c_op_print_tab, /* expression operators for printing */
|
||||
@ -992,7 +991,6 @@ extern const struct language_data cplus_language_data =
|
||||
macro_expansion_c,
|
||||
cplus_extensions,
|
||||
&exp_descriptor_c,
|
||||
c_print_typedef, /* Print a typedef using appropriate syntax */
|
||||
"this", /* name_of_this */
|
||||
false, /* la_store_sym_names_in_linkage_form_p */
|
||||
c_op_print_tab, /* expression operators for printing */
|
||||
@ -1192,7 +1190,6 @@ extern const struct language_data asm_language_data =
|
||||
macro_expansion_c,
|
||||
asm_extensions,
|
||||
&exp_descriptor_c,
|
||||
c_print_typedef, /* Print a typedef using appropriate syntax */
|
||||
NULL, /* name_of_this */
|
||||
true, /* la_store_sym_names_in_linkage_form_p */
|
||||
c_op_print_tab, /* expression operators for printing */
|
||||
@ -1250,7 +1247,6 @@ extern const struct language_data minimal_language_data =
|
||||
macro_expansion_c,
|
||||
NULL,
|
||||
&exp_descriptor_c,
|
||||
c_print_typedef, /* Print a typedef using appropriate syntax */
|
||||
NULL, /* name_of_this */
|
||||
true, /* la_store_sym_names_in_linkage_form_p */
|
||||
c_op_print_tab, /* expression operators for printing */
|
||||
|
@ -142,8 +142,6 @@ extern const struct language_data d_language_data =
|
||||
macro_expansion_no,
|
||||
d_extensions,
|
||||
&exp_descriptor_c,
|
||||
c_print_typedef, /* Print a typedef using appropriate
|
||||
syntax. */
|
||||
"this",
|
||||
false, /* la_store_sym_names_in_linkage_form_p */
|
||||
d_op_print_tab, /* Expression operators for printing. */
|
||||
|
@ -513,7 +513,6 @@ extern const struct language_data f_language_data =
|
||||
macro_expansion_no,
|
||||
f_extensions,
|
||||
&exp_descriptor_f,
|
||||
f_print_typedef, /* Print a typedef using appropriate syntax */
|
||||
NULL, /* name_of_this */
|
||||
false, /* la_store_sym_names_in_linkage_form_p */
|
||||
f_op_print_tab, /* expression operators for printing */
|
||||
@ -702,6 +701,14 @@ public:
|
||||
force_ellipses, '\'', 0, options);
|
||||
}
|
||||
|
||||
/* See language.h. */
|
||||
|
||||
void print_typedef (struct type *type, struct symbol *new_symbol,
|
||||
struct ui_file *stream) const override
|
||||
{
|
||||
f_print_typedef (type, new_symbol, stream);
|
||||
}
|
||||
|
||||
protected:
|
||||
|
||||
/* See language.h. */
|
||||
|
@ -527,8 +527,6 @@ extern const struct language_data go_language_data =
|
||||
macro_expansion_no,
|
||||
NULL,
|
||||
&exp_descriptor_c,
|
||||
c_print_typedef, /* Print a typedef using appropriate
|
||||
syntax. */
|
||||
NULL, /* name_of_this */
|
||||
false, /* la_store_sym_names_in_linkage_form_p */
|
||||
go_op_print_tab, /* Expression operators for printing. */
|
||||
|
@ -681,6 +681,15 @@ language_defn::printstr (struct ui_file *stream, struct type *elttype,
|
||||
options);
|
||||
}
|
||||
|
||||
/* See language.h. */
|
||||
|
||||
void
|
||||
language_defn::print_typedef (struct type *type, struct symbol *new_symbol,
|
||||
struct ui_file *stream) const
|
||||
{
|
||||
c_print_typedef (type, new_symbol, stream);
|
||||
}
|
||||
|
||||
/* The default implementation of the get_symbol_name_matcher_inner method
|
||||
from the language_defn class. Matches with strncmp_iw. */
|
||||
|
||||
@ -774,7 +783,6 @@ extern const struct language_data unknown_language_data =
|
||||
macro_expansion_no,
|
||||
NULL,
|
||||
&exp_descriptor_standard,
|
||||
default_print_typedef, /* Print a typedef using appropriate syntax */
|
||||
"this", /* name_of_this */
|
||||
true, /* store_sym_names_in_linkage_form_p */
|
||||
unk_op_print_tab, /* expression operators for printing */
|
||||
@ -868,6 +876,14 @@ public:
|
||||
{
|
||||
error (_("unimplemented unknown_language::printstr called"));
|
||||
}
|
||||
|
||||
/* See language.h. */
|
||||
|
||||
void print_typedef (struct type *type, struct symbol *new_symbol,
|
||||
struct ui_file *stream) const override
|
||||
{
|
||||
error (_("unimplemented unknown_language::print_typedef called"));
|
||||
}
|
||||
};
|
||||
|
||||
/* Single instance of the unknown language class. */
|
||||
@ -887,7 +903,6 @@ extern const struct language_data auto_language_data =
|
||||
macro_expansion_no,
|
||||
NULL,
|
||||
&exp_descriptor_standard,
|
||||
default_print_typedef, /* Print a typedef using appropriate syntax */
|
||||
"this", /* name_of_this */
|
||||
false, /* store_sym_names_in_linkage_form_p */
|
||||
unk_op_print_tab, /* expression operators for printing */
|
||||
@ -981,6 +996,14 @@ public:
|
||||
{
|
||||
error (_("unimplemented auto_language::printstr called"));
|
||||
}
|
||||
|
||||
/* See language.h. */
|
||||
|
||||
void print_typedef (struct type *type, struct symbol *new_symbol,
|
||||
struct ui_file *stream) const override
|
||||
{
|
||||
error (_("unimplemented auto_language::print_typedef called"));
|
||||
}
|
||||
};
|
||||
|
||||
/* Single instance of the fake "auto" language. */
|
||||
|
@ -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,
|
||||
|
@ -229,7 +229,6 @@ extern const struct language_data m2_language_data =
|
||||
macro_expansion_no,
|
||||
NULL,
|
||||
&exp_descriptor_modula2,
|
||||
m2_print_typedef, /* Print a typedef using appropriate syntax */
|
||||
NULL, /* name_of_this */
|
||||
false, /* la_store_sym_names_in_linkage_form_p */
|
||||
m2_op_print_tab, /* expression operators for printing */
|
||||
@ -427,6 +426,15 @@ public:
|
||||
if (force_ellipses || i < length)
|
||||
fputs_filtered ("...", stream);
|
||||
}
|
||||
|
||||
/* See language.h. */
|
||||
|
||||
void print_typedef (struct type *type, struct symbol *new_symbol,
|
||||
struct ui_file *stream) const override
|
||||
{
|
||||
m2_print_typedef (type, new_symbol, stream);
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
/* Single instance of the M2 language. */
|
||||
|
@ -337,7 +337,6 @@ extern const struct language_data objc_language_data =
|
||||
macro_expansion_c,
|
||||
objc_extensions,
|
||||
&exp_descriptor_standard,
|
||||
c_print_typedef, /* Print a typedef using appropriate syntax */
|
||||
"self", /* name_of_this */
|
||||
false, /* la_store_sym_names_in_linkage_form_p */
|
||||
objc_op_print_tab, /* Expression operators for printing */
|
||||
|
@ -1016,7 +1016,6 @@ extern const struct language_data opencl_language_data =
|
||||
macro_expansion_c,
|
||||
NULL,
|
||||
&exp_descriptor_opencl,
|
||||
c_print_typedef, /* Print a typedef using appropriate syntax */
|
||||
NULL, /* name_of_this */
|
||||
false, /* la_store_sym_names_in_linkage_form_p */
|
||||
c_op_print_tab, /* expression operators for printing */
|
||||
|
10
gdb/p-lang.c
10
gdb/p-lang.c
@ -276,7 +276,6 @@ extern const struct language_data pascal_language_data =
|
||||
macro_expansion_no,
|
||||
p_extensions,
|
||||
&exp_descriptor_standard,
|
||||
pascal_print_typedef, /* Print a typedef using appropriate syntax */
|
||||
"this", /* name_of_this */
|
||||
false, /* la_store_sym_names_in_linkage_form_p */
|
||||
pascal_op_print_tab, /* expression operators for printing */
|
||||
@ -494,6 +493,15 @@ public:
|
||||
if (force_ellipses || i < length)
|
||||
fputs_filtered ("...", stream);
|
||||
}
|
||||
|
||||
/* See language.h. */
|
||||
|
||||
void print_typedef (struct type *type, struct symbol *new_symbol,
|
||||
struct ui_file *stream) const override
|
||||
{
|
||||
pascal_print_typedef (type, new_symbol, stream);
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
/* Single instance of the Pascal language class. */
|
||||
|
@ -765,19 +765,6 @@ rust_print_struct_def (struct type *type, const char *varstring,
|
||||
fputs_filtered (is_tuple_struct ? ")" : "}", stream);
|
||||
}
|
||||
|
||||
/* la_print_typedef implementation for Rust. */
|
||||
|
||||
static void
|
||||
rust_print_typedef (struct type *type,
|
||||
struct symbol *new_symbol,
|
||||
struct ui_file *stream)
|
||||
{
|
||||
type = check_typedef (type);
|
||||
fprintf_filtered (stream, "type %s = ", new_symbol->print_name ());
|
||||
type_print (type, "", stream, 0);
|
||||
fprintf_filtered (stream, ";");
|
||||
}
|
||||
|
||||
/* la_print_type implementation for Rust. */
|
||||
|
||||
static void
|
||||
@ -1953,7 +1940,6 @@ extern const struct language_data rust_language_data =
|
||||
macro_expansion_no,
|
||||
rust_extensions,
|
||||
&exp_descriptor_rust,
|
||||
rust_print_typedef, /* Print a typedef using appropriate syntax */
|
||||
NULL, /* name_of_this */
|
||||
false, /* la_store_sym_names_in_linkage_form_p */
|
||||
c_op_print_tab, /* expression operators for printing */
|
||||
@ -2155,6 +2141,17 @@ public:
|
||||
rust_printstr (stream, elttype, string, length, encoding,
|
||||
force_ellipses, options);
|
||||
}
|
||||
|
||||
/* See language.h. */
|
||||
|
||||
void print_typedef (struct type *type, struct symbol *new_symbol,
|
||||
struct ui_file *stream) const override
|
||||
{
|
||||
type = check_typedef (type);
|
||||
fprintf_filtered (stream, "type %s = ", new_symbol->print_name ());
|
||||
type_print (type, "", stream, 0);
|
||||
fprintf_filtered (stream, ";");
|
||||
}
|
||||
};
|
||||
|
||||
/* Single instance of the Rust language class. */
|
||||
|
@ -368,15 +368,6 @@ typedef_print (struct type *type, struct symbol *newobj, struct ui_file *stream)
|
||||
LA_PRINT_TYPEDEF (type, newobj, stream);
|
||||
}
|
||||
|
||||
/* The default way to print a typedef. */
|
||||
|
||||
void
|
||||
default_print_typedef (struct type *type, struct symbol *new_symbol,
|
||||
struct ui_file *stream)
|
||||
{
|
||||
error (_("Language not supported."));
|
||||
}
|
||||
|
||||
/* Print a description of a type TYPE in the form of a declaration of a
|
||||
variable named VARSTRING. (VARSTRING is demangled if necessary.)
|
||||
Output goes to STREAM (via stdio).
|
||||
|
Loading…
Reference in New Issue
Block a user