gdb: Convert language la_print_type field to a method
This commit changes the language_data::la_print_type 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_type initializer. (ada_language::print_type): New member function. * c-lang.c (c_language_data): Delete la_print_type initializer. (c_language::print_type): New member function. (cplus_language_data): Delete la_print_type initializer. (cplus_language::print_type): New member function. (asm_language_data): Delete la_print_type initializer. (asm_language::print_type): New member function. (minimal_language_data): Delete la_print_type initializer. (minimal_language::print_type): New member function. * d-lang.c (d_language_data): Delete la_print_type initializer. (d_language::print_type): New member function. * f-lang.c (f_language_data): Delete la_print_type initializer. (f_language::print_type): New member function. * go-lang.c (go_language_data): Delete la_print_type initializer. (go_language::print_type): New member function. * language.c (unk_lang_print_type): Delete. (unknown_language_data): Delete la_print_type initializer. (unknown_language::print_type): New member function. (auto_language_data): Delete la_print_type initializer. (auto_language::print_type): New member function. * language.h (language_data): Delete la_print_type field. (language_defn::print_type): New function. (LA_PRINT_TYPE): Update. * m2-lang.c (m2_language_data): Delete la_print_type initializer. (m2_language::print_type): New member function. * objc-lang.c (objc_language_data): Delete la_print_type initializer. (objc_language::print_type): New member function. * opencl-lang.c (opencl_print_type): Delete, implementation moved to opencl_language::print_type. (opencl_language_data): Delete la_print_type initializer. (opencl_language::print_type): New member function, implementation from opencl_print_type. * p-lang.c (pascal_language_data): Delete la_print_type initializer. (pascal_language::print_type): New member function. * rust-lang.c (rust_print_type): Delete, implementation moved to rust_language::print_type. (rust_language_data): Delete la_print_type initializer. (rust_language::print_type): New member function, implementation from rust_print_type.
This commit is contained in:
parent
6f8270197a
commit
fbfb0a463f
13 changed files with 200 additions and 61 deletions
|
@ -994,27 +994,6 @@ Cannot perform conditional operation on vectors with different sizes"));
|
|||
return evaluate_subexp_c (expect_type, exp, pos, noside);
|
||||
}
|
||||
|
||||
/* Print OpenCL types. */
|
||||
|
||||
static void
|
||||
opencl_print_type (struct type *type, const char *varstring,
|
||||
struct ui_file *stream, int show, int level,
|
||||
const struct type_print_options *flags)
|
||||
{
|
||||
/* We nearly always defer to C type printing, except that vector
|
||||
types are considered primitive in OpenCL, and should always
|
||||
be printed using their TYPE_NAME. */
|
||||
if (show > 0)
|
||||
{
|
||||
type = check_typedef (type);
|
||||
if (type->code () == TYPE_CODE_ARRAY && TYPE_VECTOR (type)
|
||||
&& type->name () != NULL)
|
||||
show = 0;
|
||||
}
|
||||
|
||||
c_print_type (type, varstring, stream, show, level, flags);
|
||||
}
|
||||
|
||||
const struct exp_descriptor exp_descriptor_opencl =
|
||||
{
|
||||
print_subexp_standard,
|
||||
|
@ -1042,7 +1021,6 @@ extern const struct language_data opencl_language_data =
|
|||
c_printchar, /* Print a character constant */
|
||||
c_printstr, /* Function to print string constant */
|
||||
c_emit_char, /* Print a single char */
|
||||
opencl_print_type, /* Print a type using appropriate syntax */
|
||||
c_print_typedef, /* Print a typedef using appropriate syntax */
|
||||
c_value_print_inner, /* la_value_print_inner */
|
||||
c_value_print, /* Print a top-level value */
|
||||
|
@ -1091,6 +1069,26 @@ public:
|
|||
lai->bool_type_symbol = "int";
|
||||
lai->bool_type_default = types [opencl_primitive_type_int];
|
||||
}
|
||||
|
||||
/* See language.h. */
|
||||
|
||||
void print_type (struct type *type, const char *varstring,
|
||||
struct ui_file *stream, int show, int level,
|
||||
const struct type_print_options *flags) const override
|
||||
{
|
||||
/* We nearly always defer to C type printing, except that vector types
|
||||
are considered primitive in OpenCL, and should always be printed
|
||||
using their TYPE_NAME. */
|
||||
if (show > 0)
|
||||
{
|
||||
type = check_typedef (type);
|
||||
if (type->code () == TYPE_CODE_ARRAY && TYPE_VECTOR (type)
|
||||
&& type->name () != NULL)
|
||||
show = 0;
|
||||
}
|
||||
|
||||
c_print_type (type, varstring, stream, show, level, flags);
|
||||
}
|
||||
};
|
||||
|
||||
/* Single instance of the OpenCL language class. */
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue