+2020-06-02 Andrew Burgess <andrew.burgess@embecosm.com>
+
+ * ada-lang.c (ada_print_array_index): Delete function, move
+ implementation to...
+ (ada_language::print_array_index): ...here.
+ (ada_language_data): Delete la_print_array_index initializer.
+ * c-lang.c (c_language_data): Likewise.
+ (cplus_language_data): Likewise.
+ (minimal_language_data): Likewise.
+ * d-lang.c (d_language_data): Likewise.
+ * f-lang.c (f_language_data): Likewise.
+ * go-lang.c (go_language_data): Likewise.
+ * language.c (default_print_array_index): Delete function, move
+ implementation to...
+ (language_defn::print_array_index): ...here.
+ (unknown_language_data): Delete la_print_array_index initializer.
+ (auto_language_data): Likewise.
+ * language.h (struct language_data): Delete la_print_array_index
+ field.
+ (language_defn::print_array_index): New member function.
+ (LA_PRINT_ARRAY_INDEX): Update.
+ (default_print_array_index): Delete declaration.
+ * m2-lang.c (m2_language_data): Delete la_print_array_index
+ 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-02 Andrew Burgess <andrew.burgess@embecosm.com>
* gdb/ada-lang.c (ada_language_defn): Convert to...
return ada_completer_word_break_characters;
}
-/* Print an array element index using the Ada syntax. */
-
-static void
-ada_print_array_index (struct type *index_type, LONGEST index,
- struct ui_file *stream,
- const struct value_print_options *options)
-{
- struct value *index_value = val_atr (index_type, index);
-
- LA_VALUE_PRINT (index_value, stream, options);
- fprintf_filtered (stream, " => ");
-}
-
/* la_watch_location_expression for Ada. */
static gdb::unique_xmalloc_ptr<char>
ada_get_gdb_completer_word_break_characters,
ada_collect_symbol_completion_matches,
ada_language_arch_info,
- ada_print_array_index,
default_pass_by_reference,
ada_watch_location_expression,
ada_get_symbol_name_matcher, /* la_get_symbol_name_matcher */
ada_language ()
: language_defn (language_ada, ada_language_data)
{ /* Nothing. */ }
+
+ /* Print an array element index using the Ada syntax. */
+
+ void print_array_index (struct type *index_type,
+ LONGEST index,
+ struct ui_file *stream,
+ const value_print_options *options) const override
+ {
+ struct value *index_value = val_atr (index_type, index);
+
+ LA_VALUE_PRINT (index_value, stream, options);
+ fprintf_filtered (stream, " => ");
+ }
};
/* Single instance of the Ada language class. */
default_word_break_characters,
default_collect_symbol_completion_matches,
c_language_arch_info,
- default_print_array_index,
default_pass_by_reference,
c_watch_location_expression,
NULL, /* la_get_symbol_name_matcher */
default_word_break_characters,
default_collect_symbol_completion_matches,
cplus_language_arch_info,
- default_print_array_index,
cp_pass_by_reference,
c_watch_location_expression,
cp_get_symbol_name_matcher,
default_word_break_characters,
default_collect_symbol_completion_matches,
c_language_arch_info, /* FIXME: la_language_arch_info. */
- default_print_array_index,
default_pass_by_reference,
c_watch_location_expression,
NULL, /* la_get_symbol_name_matcher */
default_word_break_characters,
default_collect_symbol_completion_matches,
c_language_arch_info,
- default_print_array_index,
default_pass_by_reference,
c_watch_location_expression,
NULL, /* la_get_symbol_name_matcher */
default_word_break_characters,
default_collect_symbol_completion_matches,
d_language_arch_info,
- default_print_array_index,
default_pass_by_reference,
c_watch_location_expression,
NULL, /* la_get_symbol_name_matcher */
f_word_break_characters,
f_collect_symbol_completion_matches,
f_language_arch_info,
- default_print_array_index,
default_pass_by_reference,
c_watch_location_expression,
cp_get_symbol_name_matcher, /* la_get_symbol_name_matcher */
default_word_break_characters,
default_collect_symbol_completion_matches,
go_language_arch_info,
- default_print_array_index,
default_pass_by_reference,
c_watch_location_expression,
NULL, /* la_get_symbol_name_matcher */
return " \t\n!@#$%^&*()+=|~`}{[]\"';:?/>.<,-";
}
-/* Print the index of array elements using the C99 syntax. */
+/* See language.h. */
void
-default_print_array_index (struct type *index_type, LONGEST index,
- struct ui_file *stream,
- const struct value_print_options *options)
+language_defn::print_array_index (struct type *index_type, LONGEST index,
+ struct ui_file *stream,
+ const value_print_options *options) const
{
struct value *index_value = value_from_longest (index_type, index);
default_word_break_characters,
default_collect_symbol_completion_matches,
unknown_language_arch_info, /* la_language_arch_info. */
- default_print_array_index,
default_pass_by_reference,
c_watch_location_expression,
NULL, /* la_get_symbol_name_matcher */
default_word_break_characters,
default_collect_symbol_completion_matches,
unknown_language_arch_info, /* la_language_arch_info. */
- default_print_array_index,
default_pass_by_reference,
c_watch_location_expression,
NULL, /* la_get_symbol_name_matcher */
void (*la_language_arch_info) (struct gdbarch *,
struct language_arch_info *);
- /* Print the index of an element of an array. */
- void (*la_print_array_index) (struct type *index_type,
- LONGEST index_value,
- struct ui_file *stream,
- const struct value_print_options *options);
-
/* Return information about whether TYPE should be passed
(and returned) by reference at the language level. */
struct language_pass_by_ref_info (*la_pass_by_reference)
languages[lang] = this;
}
+ /* Print the index of an element of an array. This default
+ implementation prints using C99 syntax. */
+
+ virtual void print_array_index (struct type *index_type,
+ LONGEST index_value,
+ struct ui_file *stream,
+ const value_print_options *options) const;
+
/* List of all known languages. */
static const struct language_defn *languages[nr_languages];
};
(current_language->la_emitchar(ch, type, stream, quoter))
#define LA_PRINT_ARRAY_INDEX(index_type, index_value, stream, options) \
- (current_language->la_print_array_index(index_type, index_value, stream, \
- options))
+ (current_language->print_array_index(index_type, index_value, stream, \
+ options))
#define LA_ITERATE_OVER_SYMBOLS(BLOCK, NAME, DOMAIN, CALLBACK) \
(current_language->la_iterate_over_symbols (BLOCK, NAME, DOMAIN, CALLBACK))
/* Splitting strings into words. */
extern const char *default_word_break_characters (void);
-/* Print the index of an array element using the C99 syntax. */
-extern void default_print_array_index (struct type *index_type, LONGEST index,
- struct ui_file *stream,
- const struct value_print_options *options);
-
/* Return information about whether TYPE should be passed
(and returned) by reference at the language level. */
struct language_pass_by_ref_info language_pass_by_reference (struct type *type);
default_word_break_characters,
default_collect_symbol_completion_matches,
m2_language_arch_info,
- default_print_array_index,
default_pass_by_reference,
c_watch_location_expression,
NULL, /* la_get_symbol_name_matcher */
default_word_break_characters,
default_collect_symbol_completion_matches,
c_language_arch_info,
- default_print_array_index,
default_pass_by_reference,
c_watch_location_expression,
NULL, /* la_get_symbol_name_matcher */
default_word_break_characters,
default_collect_symbol_completion_matches,
opencl_language_arch_info,
- default_print_array_index,
default_pass_by_reference,
c_watch_location_expression,
NULL, /* la_get_symbol_name_matcher */
default_word_break_characters,
default_collect_symbol_completion_matches,
pascal_language_arch_info,
- default_print_array_index,
default_pass_by_reference,
c_watch_location_expression,
NULL, /* la_compare_symbol_for_completion */
default_word_break_characters,
default_collect_symbol_completion_matches,
rust_language_arch_info,
- default_print_array_index,
default_pass_by_reference,
rust_watch_location_expression,
NULL, /* la_get_symbol_name_matcher */