+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.
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 */
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. */
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 */
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 */
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 */
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 */
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. */
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 */
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. */
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. */
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. */
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 */
{
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. */
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 */
{
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. */
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
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.
(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))
(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,
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 */
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. */
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 */
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 */
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 */
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. */
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
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 */
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. */
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).