gdb: Convert language_data::la_op_print_tab to a method
Convert language_data::la_op_print_tab member variable to a virtual method language_defn::opcode_print_table. I changed the name in order to make it clearer (I hope) what the method does. There should be no user visible changes after this commit. gdb/ChangeLog: * ada-lang.c (ada_language_data): Remove la_op_print_tab initializer. (ada_language::opcode_print_table): New member function. * c-lang.c (c_language_data): Remove la_op_print_tab initializer. (c_language::opcode_print_table): New member function. (cplus_language_data): Remove la_op_print_tab initializer. (cplus_language::opcode_print_table): New member function. (asm_language_data): Remove la_op_print_tab initializer. (asm_language::opcode_print_table): New member function. (minimal_language_data): Remove la_op_print_tab initializer. (minimal_language::opcode_print_table): New member function. * d-lang.c (d_language_data): Remove la_op_print_tab initializer. (d_language::opcode_print_table): New member function. * expprint.c (print_subexp_standard): Update call to opcode_print_table. (op_string): Likewise. * f-lang.c (f_language_data): Remove la_op_print_tab initializer. (f_language::opcode_print_table): New member function. * go-lang.c (go_language_data): Remove la_op_print_tab initializer. (go_language::opcode_print_table): New member function. * language.c (unknown_language_data): Remove la_op_print_tab initializer. (unknown_language::opcode_print_table): New member function. (auto_language_data): Remove la_op_print_tab initializer. (auto_language::opcode_print_table): New member function. * language.h (language_data): Remove la_op_print_tab field. (language_defn::opcode_print_table): Declare new member function. * m2-lang.c (m2_language_data): Remove la_op_print_tab initializer. (m2_language::opcode_print_table): New member function. * objc-lang.c (objc_language_data): Remove la_op_print_tab initializer. (objc_language::opcode_print_table): New member function. * opencl-lang.c (opencl_language_data): Remove la_op_print_tab initializer. (opencl_language::opcode_print_table): New member function. * p-lang.c (pascal_language_data): Remove la_op_print_tab initializer. (pascal_language::opcode_print_table): New member function. * rust-lang.c (rust_language_data): Remove la_op_print_tab initializer. (rust_language::opcode_print_table): New member function.
This commit is contained in:
parent
5aba6ebefb
commit
b7c6e27dbb
14 changed files with 127 additions and 20 deletions
|
@ -1,3 +1,49 @@
|
|||
2020-09-16 Andrew Burgess <andrew.burgess@embecosm.com>
|
||||
|
||||
* ada-lang.c (ada_language_data): Remove la_op_print_tab
|
||||
initializer.
|
||||
(ada_language::opcode_print_table): New member function.
|
||||
* c-lang.c (c_language_data): Remove la_op_print_tab initializer.
|
||||
(c_language::opcode_print_table): New member function.
|
||||
(cplus_language_data): Remove la_op_print_tab initializer.
|
||||
(cplus_language::opcode_print_table): New member function.
|
||||
(asm_language_data): Remove la_op_print_tab initializer.
|
||||
(asm_language::opcode_print_table): New member function.
|
||||
(minimal_language_data): Remove la_op_print_tab initializer.
|
||||
(minimal_language::opcode_print_table): New member function.
|
||||
* d-lang.c (d_language_data): Remove la_op_print_tab initializer.
|
||||
(d_language::opcode_print_table): New member function.
|
||||
* expprint.c (print_subexp_standard): Update call to
|
||||
opcode_print_table.
|
||||
(op_string): Likewise.
|
||||
* f-lang.c (f_language_data): Remove la_op_print_tab initializer.
|
||||
(f_language::opcode_print_table): New member function.
|
||||
* go-lang.c (go_language_data): Remove la_op_print_tab
|
||||
initializer.
|
||||
(go_language::opcode_print_table): New member function.
|
||||
* language.c (unknown_language_data): Remove la_op_print_tab
|
||||
initializer.
|
||||
(unknown_language::opcode_print_table): New member function.
|
||||
(auto_language_data): Remove la_op_print_tab initializer.
|
||||
(auto_language::opcode_print_table): New member function.
|
||||
* language.h (language_data): Remove la_op_print_tab field.
|
||||
(language_defn::opcode_print_table): Declare new member function.
|
||||
* m2-lang.c (m2_language_data): Remove la_op_print_tab
|
||||
initializer.
|
||||
(m2_language::opcode_print_table): New member function.
|
||||
* objc-lang.c (objc_language_data): Remove la_op_print_tab
|
||||
initializer.
|
||||
(objc_language::opcode_print_table): New member function.
|
||||
* opencl-lang.c (opencl_language_data): Remove la_op_print_tab
|
||||
initializer.
|
||||
(opencl_language::opcode_print_table): New member function.
|
||||
* p-lang.c (pascal_language_data): Remove la_op_print_tab
|
||||
initializer.
|
||||
(pascal_language::opcode_print_table): New member function.
|
||||
* rust-lang.c (rust_language_data): Remove la_op_print_tab
|
||||
initializer.
|
||||
(rust_language::opcode_print_table): New member function.
|
||||
|
||||
2020-09-16 Andrew Burgess <andrew.burgess@embecosm.com>
|
||||
|
||||
* ada-lang.c (ada_language_data): Remove la_exp_desc initializer.
|
||||
|
|
|
@ -13708,7 +13708,6 @@ ada_get_symbol_name_matcher (const lookup_name_info &lookup_name)
|
|||
|
||||
extern const struct language_data ada_language_data =
|
||||
{
|
||||
ada_op_print_tab, /* expression operators for printing */
|
||||
};
|
||||
|
||||
/* Class representing the Ada language. */
|
||||
|
@ -14210,6 +14209,11 @@ public:
|
|||
const struct exp_descriptor *expression_ops () const override
|
||||
{ return &ada_exp_descriptor; }
|
||||
|
||||
/* See language.h. */
|
||||
|
||||
const struct op_print *opcode_print_table () const override
|
||||
{ return ada_op_print_tab; }
|
||||
|
||||
protected:
|
||||
/* See language.h. */
|
||||
|
||||
|
|
24
gdb/c-lang.c
24
gdb/c-lang.c
|
@ -875,7 +875,6 @@ const struct exp_descriptor exp_descriptor_c =
|
|||
|
||||
extern const struct language_data c_language_data =
|
||||
{
|
||||
c_op_print_tab, /* expression operators for printing */
|
||||
};
|
||||
|
||||
/* Class representing the C language. */
|
||||
|
@ -951,6 +950,11 @@ public:
|
|||
|
||||
const struct exp_descriptor *expression_ops () const override
|
||||
{ return &exp_descriptor_c; }
|
||||
|
||||
/* See language.h. */
|
||||
|
||||
const struct op_print *opcode_print_table () const override
|
||||
{ return c_op_print_tab; }
|
||||
};
|
||||
|
||||
/* Single instance of the C language class. */
|
||||
|
@ -989,7 +993,6 @@ enum cplus_primitive_types {
|
|||
|
||||
extern const struct language_data cplus_language_data =
|
||||
{
|
||||
c_op_print_tab, /* expression operators for printing */
|
||||
};
|
||||
|
||||
/* A class for the C++ language. */
|
||||
|
@ -1187,6 +1190,11 @@ public:
|
|||
const struct exp_descriptor *expression_ops () const override
|
||||
{ return &exp_descriptor_c; }
|
||||
|
||||
/* See language.h. */
|
||||
|
||||
const struct op_print *opcode_print_table () const override
|
||||
{ return c_op_print_tab; }
|
||||
|
||||
protected:
|
||||
|
||||
/* See language.h. */
|
||||
|
@ -1206,7 +1214,6 @@ static cplus_language cplus_language_defn;
|
|||
|
||||
extern const struct language_data asm_language_data =
|
||||
{
|
||||
c_op_print_tab, /* expression operators for printing */
|
||||
};
|
||||
|
||||
/* A class for the ASM language. */
|
||||
|
@ -1269,6 +1276,11 @@ public:
|
|||
|
||||
const struct exp_descriptor *expression_ops () const override
|
||||
{ return &exp_descriptor_c; }
|
||||
|
||||
/* See language.h. */
|
||||
|
||||
const struct op_print *opcode_print_table () const override
|
||||
{ return c_op_print_tab; }
|
||||
};
|
||||
|
||||
/* The single instance of the ASM language class. */
|
||||
|
@ -1281,7 +1293,6 @@ static asm_language asm_language_defn;
|
|||
|
||||
extern const struct language_data minimal_language_data =
|
||||
{
|
||||
c_op_print_tab, /* expression operators for printing */
|
||||
};
|
||||
|
||||
/* A class for the minimal language. */
|
||||
|
@ -1333,6 +1344,11 @@ public:
|
|||
|
||||
const struct exp_descriptor *expression_ops () const override
|
||||
{ return &exp_descriptor_c; }
|
||||
|
||||
/* See language.h. */
|
||||
|
||||
const struct op_print *opcode_print_table () const override
|
||||
{ return c_op_print_tab; }
|
||||
};
|
||||
|
||||
/* The single instance of the minimal language class. */
|
||||
|
|
|
@ -128,7 +128,6 @@ enum d_primitive_types {
|
|||
|
||||
extern const struct language_data d_language_data =
|
||||
{
|
||||
d_op_print_tab, /* Expression operators for printing. */
|
||||
};
|
||||
|
||||
/* Class representing the D language. */
|
||||
|
@ -280,6 +279,11 @@ public:
|
|||
|
||||
const struct exp_descriptor *expression_ops () const override
|
||||
{ return &exp_descriptor_c; }
|
||||
|
||||
/* See language.h. */
|
||||
|
||||
const struct op_print *opcode_print_table () const override
|
||||
{ return d_op_print_tab; }
|
||||
};
|
||||
|
||||
/* Single instance of the D language class. */
|
||||
|
|
|
@ -73,7 +73,7 @@ print_subexp_standard (struct expression *exp, int *pos,
|
|||
struct value *val;
|
||||
char *tempstr = NULL;
|
||||
|
||||
op_print_tab = exp->language_defn->la_op_print_tab;
|
||||
op_print_tab = exp->language_defn->opcode_print_table ();
|
||||
pc = (*pos)++;
|
||||
opcode = exp->elts[pc].opcode;
|
||||
switch (opcode)
|
||||
|
@ -669,7 +669,7 @@ op_string (enum exp_opcode op)
|
|||
int tem;
|
||||
const struct op_print *op_print_tab;
|
||||
|
||||
op_print_tab = current_language->la_op_print_tab;
|
||||
op_print_tab = current_language->opcode_print_table ();
|
||||
for (tem = 0; op_print_tab[tem].opcode != OP_NULL; tem++)
|
||||
if (op_print_tab[tem].opcode == op)
|
||||
return op_print_tab[tem].string;
|
||||
|
|
|
@ -486,7 +486,6 @@ static const struct exp_descriptor exp_descriptor_f =
|
|||
|
||||
extern const struct language_data f_language_data =
|
||||
{
|
||||
f_op_print_tab, /* expression operators for printing */
|
||||
};
|
||||
|
||||
/* Class representing the Fortran language. */
|
||||
|
@ -736,6 +735,11 @@ public:
|
|||
const struct exp_descriptor *expression_ops () const override
|
||||
{ return &exp_descriptor_f; }
|
||||
|
||||
/* See language.h. */
|
||||
|
||||
const struct op_print *opcode_print_table () const override
|
||||
{ return f_op_print_tab; }
|
||||
|
||||
protected:
|
||||
|
||||
/* See language.h. */
|
||||
|
|
|
@ -508,7 +508,6 @@ enum go_primitive_types {
|
|||
|
||||
extern const struct language_data go_language_data =
|
||||
{
|
||||
go_op_print_tab, /* Expression operators for printing. */
|
||||
};
|
||||
|
||||
/* Class representing the Go language. */
|
||||
|
@ -641,6 +640,11 @@ public:
|
|||
|
||||
const struct exp_descriptor *expression_ops () const override
|
||||
{ return &exp_descriptor_c; }
|
||||
|
||||
/* See language.h. */
|
||||
|
||||
const struct op_print *opcode_print_table () const override
|
||||
{ return go_op_print_tab; }
|
||||
};
|
||||
|
||||
/* Single instance of the Go language class. */
|
||||
|
|
|
@ -816,7 +816,6 @@ unknown_language_arch_info (struct gdbarch *gdbarch,
|
|||
|
||||
extern const struct language_data unknown_language_data =
|
||||
{
|
||||
unk_op_print_tab, /* expression operators for printing */
|
||||
};
|
||||
|
||||
/* Class representing the unknown language. */
|
||||
|
@ -937,6 +936,11 @@ public:
|
|||
|
||||
bool store_sym_names_in_linkage_form_p () const override
|
||||
{ return true; }
|
||||
|
||||
/* See language.h. */
|
||||
|
||||
const struct op_print *opcode_print_table () const override
|
||||
{ return unk_op_print_tab; }
|
||||
};
|
||||
|
||||
/* Single instance of the unknown language class. */
|
||||
|
@ -947,7 +951,6 @@ static unknown_language unknown_language_defn;
|
|||
|
||||
extern const struct language_data auto_language_data =
|
||||
{
|
||||
unk_op_print_tab, /* expression operators for printing */
|
||||
};
|
||||
|
||||
/* Class representing the fake "auto" language. */
|
||||
|
@ -1063,6 +1066,11 @@ public:
|
|||
|
||||
const char *name_of_this () const override
|
||||
{ return "this"; }
|
||||
|
||||
/* See language.h. */
|
||||
|
||||
const struct op_print *opcode_print_table () const override
|
||||
{ return unk_op_print_tab; }
|
||||
};
|
||||
|
||||
/* Single instance of the fake "auto" language. */
|
||||
|
|
|
@ -168,9 +168,6 @@ extern const char *default_word_break_characters (void);
|
|||
|
||||
struct language_data
|
||||
{
|
||||
/* Table for printing expressions. */
|
||||
|
||||
const struct op_print *la_op_print_tab;
|
||||
};
|
||||
|
||||
/* Base class from which all other language classes derive. */
|
||||
|
@ -567,6 +564,10 @@ struct language_defn : language_data
|
|||
|
||||
virtual const struct exp_descriptor *expression_ops () const;
|
||||
|
||||
/* Table for printing expressions. */
|
||||
|
||||
virtual const struct op_print *opcode_print_table () const = 0;
|
||||
|
||||
protected:
|
||||
|
||||
/* This is the overridable part of the GET_SYMBOL_NAME_MATCHER method.
|
||||
|
|
|
@ -199,7 +199,6 @@ const struct exp_descriptor exp_descriptor_modula2 =
|
|||
|
||||
extern const struct language_data m2_language_data =
|
||||
{
|
||||
m2_op_print_tab, /* expression operators for printing */
|
||||
};
|
||||
|
||||
/* Class representing the M2 language. */
|
||||
|
@ -448,6 +447,11 @@ public:
|
|||
|
||||
const struct exp_descriptor *expression_ops () const override
|
||||
{ return &exp_descriptor_modula2; }
|
||||
|
||||
/* See language.h. */
|
||||
|
||||
const struct op_print *opcode_print_table () const override
|
||||
{ return m2_op_print_tab; }
|
||||
};
|
||||
|
||||
/* Single instance of the M2 language. */
|
||||
|
|
|
@ -323,7 +323,6 @@ static const struct op_print objc_op_print_tab[] =
|
|||
|
||||
extern const struct language_data objc_language_data =
|
||||
{
|
||||
objc_op_print_tab, /* Expression operators for printing */
|
||||
};
|
||||
|
||||
/* Class representing the Objective-C language. */
|
||||
|
@ -427,6 +426,11 @@ public:
|
|||
|
||||
enum macro_expansion macro_expansion () const override
|
||||
{ return macro_expansion_c; }
|
||||
|
||||
/* See language.h. */
|
||||
|
||||
const struct op_print *opcode_print_table () const override
|
||||
{ return c_op_print_tab; }
|
||||
};
|
||||
|
||||
/* Single instance of the class representing the Objective-C language. */
|
||||
|
|
|
@ -1006,7 +1006,6 @@ const struct exp_descriptor exp_descriptor_opencl =
|
|||
/* Constant data representing the OpenCL language. */
|
||||
extern const struct language_data opencl_language_data =
|
||||
{
|
||||
c_op_print_tab, /* expression operators for printing */
|
||||
};
|
||||
|
||||
/* Class representing the OpenCL language. */
|
||||
|
@ -1074,6 +1073,11 @@ public:
|
|||
|
||||
const struct exp_descriptor *expression_ops () const override
|
||||
{ return &exp_descriptor_opencl; }
|
||||
|
||||
/* See language.h. */
|
||||
|
||||
const struct op_print *opcode_print_table () const override
|
||||
{ return c_op_print_tab; }
|
||||
};
|
||||
|
||||
/* Single instance of the OpenCL language class. */
|
||||
|
|
|
@ -252,7 +252,6 @@ enum pascal_primitive_types {
|
|||
|
||||
extern const struct language_data pascal_language_data =
|
||||
{
|
||||
pascal_op_print_tab, /* expression operators for printing */
|
||||
};
|
||||
|
||||
/* Class representing the Pascal language. */
|
||||
|
@ -507,6 +506,11 @@ public:
|
|||
|
||||
bool range_checking_on_by_default () const override
|
||||
{ return true; }
|
||||
|
||||
/* See language.h. */
|
||||
|
||||
const struct op_print *opcode_print_table () const override
|
||||
{ return pascal_op_print_tab; }
|
||||
};
|
||||
|
||||
/* Single instance of the Pascal language class. */
|
||||
|
|
|
@ -1901,7 +1901,6 @@ static const struct exp_descriptor exp_descriptor_rust =
|
|||
|
||||
extern const struct language_data rust_language_data =
|
||||
{
|
||||
c_op_print_tab, /* expression operators for printing */
|
||||
};
|
||||
|
||||
/* Class representing the Rust language. */
|
||||
|
@ -2153,6 +2152,11 @@ public:
|
|||
|
||||
const struct exp_descriptor *expression_ops () const override
|
||||
{ return &exp_descriptor_rust; }
|
||||
|
||||
/* See language.h. */
|
||||
|
||||
const struct op_print *opcode_print_table () const override
|
||||
{ return c_op_print_tab; }
|
||||
};
|
||||
|
||||
/* Single instance of the Rust language class. */
|
||||
|
|
Loading…
Add table
Reference in a new issue