mirror of
https://github.com/espressif/binutils-gdb.git
synced 2025-06-04 13:57:12 +08:00
Always pass an explicit language down to c_type_print
The next patch will want to do language->print_type(type, ...), to print a type in a given language, avoiding a dependency on the current language. That doesn't work correctly currently, however, because most language implementations of language_defn::print_type call c_print_type without passing down the language. There are two overloads of c_print_type, one that takes a language, and one that does not. The one that does not uses the current language, defeating the point of calling language->print_type()... This commit removes the c_print_type overload that does not take a language, and adjusts the codebase throughout to always pass down a language. In most places, there's already an enum language handy. language_defn::print_type implementations naturally pass down this->la_language. In a couple spots, like in ada-typeprint.c and rust-lang.c there's no enum language handy, but the code is written for a specific language, so we just hardcode the language. In gnuv3_print_method_ptr, I wasn't sure whether we could hardcode C++ here, and we don't have an enum language handy, so I made it use the current language, just like today. Can always be improved later. Change-Id: Ib54fab4cf0fd307bfd55bf1dd5056830096a653b
This commit is contained in:
17
gdb/c-lang.h
17
gdb/c-lang.h
@ -65,16 +65,17 @@ extern int c_parse (struct parser_state *);
|
||||
extern int c_parse_escape (const char **, struct obstack *);
|
||||
|
||||
/* Defined in c-typeprint.c */
|
||||
extern void c_print_type (struct type *, const char *,
|
||||
struct ui_file *, int, int,
|
||||
const struct type_print_options *);
|
||||
|
||||
/* Print a type but allow the precise language to be specified. */
|
||||
/* Print TYPE to STREAM using syntax appropriate for LANGUAGE, a
|
||||
C-like language. The other parameters are like
|
||||
type_language_defn::print_type's. */
|
||||
|
||||
extern void c_print_type (struct type *, const char *,
|
||||
struct ui_file *, int, int,
|
||||
enum language,
|
||||
const struct type_print_options *);
|
||||
extern void c_print_type (struct type *type,
|
||||
const char *varstring,
|
||||
struct ui_file *stream,
|
||||
int show, int level,
|
||||
enum language language,
|
||||
const struct type_print_options *flags);
|
||||
|
||||
extern void c_print_typedef (struct type *,
|
||||
struct symbol *,
|
||||
|
Reference in New Issue
Block a user