gdb: Convert language_data::la_op_print_tab to a method
authorAndrew Burgess <andrew.burgess@embecosm.com>
Tue, 4 Aug 2020 16:07:59 +0000 (17:07 +0100)
committerAndrew Burgess <andrew.burgess@embecosm.com>
Wed, 16 Sep 2020 10:04:04 +0000 (11:04 +0100)
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.

14 files changed:
gdb/ChangeLog
gdb/ada-lang.c
gdb/c-lang.c
gdb/d-lang.c
gdb/expprint.c
gdb/f-lang.c
gdb/go-lang.c
gdb/language.c
gdb/language.h
gdb/m2-lang.c
gdb/objc-lang.c
gdb/opencl-lang.c
gdb/p-lang.c
gdb/rust-lang.c

index d646595e731ce812b9de6d619b353383297ce699..f1fcbcfa827031fcfd58612d595995b251efdf9f 100644 (file)
@@ -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.
index 876125c4f188f05ed60f859faa4b6664a48eaf3d..edf0d6b135f1183263de5cca1abee697fc2069fb 100644 (file)
@@ -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.  */
 
index f29f3407e161659ee71036749833b5d903785bac..73968ed20f457eb72f250ff62e98a892ba3db0cf 100644 (file)
@@ -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.  */
index 4b8020e2ec9db4d378ac31d30180d44af7d565f0..f9967868e1e0a80b7b9dd89044ca33a89e183a20 100644 (file)
@@ -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.  */
index 8cca5b4f92cba05a152f3ca0ecf24c924c41fd38..5bd9553a4112c2fc78dd70c79d25ba746834ddc3 100644 (file)
@@ -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;
index 2bf046d64f9de41ee4654dd1ab149e941ad411cc..510d06737ead07b99a0fd76b806d0a94cd2a8573 100644 (file)
@@ -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.  */
index eacc4debf42167e0efa52862073f7ccd9b6c7309..2b9be93b2e5c37cb7bb5d424ab382e90168d3010 100644 (file)
@@ -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.  */
index b467512e80dba2d5f785343a7daf5b04a11564b2..37aef2cd73b9938c3e571a50a7c228c5b8ef5fd2 100644 (file)
@@ -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.  */
index cfb3461a8cdc8a7db41cb8bf7a991fd11233a879..2d13cfa9db9819e51e0307541349c59147c816e7 100644 (file)
@@ -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.
index b41d0b48d6e6045cd2e888a9a04fd2c3a2297a00..1f9c8a878e46dd23248ed3bd8daaca33cf2d9ebb 100644 (file)
@@ -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.  */
index e78e0871aa9cfba31610819d8f6ae0ddd0e66e63..b59a45b49beb7f92edf0d2f100d89df1e50d93fe 100644 (file)
@@ -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.  */
index e7186ebbf3f31b1b329c79650ee140bce78c3f4c..df99fdc2f4bf8d0e423dfc0fe98486d6f16deb8e 100644 (file)
@@ -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.  */
index 1acd591d41c92481be36722ac93924ba3517b44c..6a9811d869c9e1363c98f0f566001817bb82de9a 100644 (file)
@@ -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.  */
index 8c952e394fbc7b71c6f08e9b8f319664c26f2fcb..1971a8d3a38fdc41c26f9f8b45da4e1adbc4f8d8 100644 (file)
@@ -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.  */
This page took 0.039694 seconds and 4 git commands to generate.