gdb: Convert language_data::la_varobj_ops to a method

Convert language_data::la_varobj_ops member variable to a virtual
method language_defn::varobj_ops.

There should be no user visible changes after this commit.

gdb/ChangeLog:

	* ada-lang.c (ada_language_data): Remove la_varobj_ops
	initializer.
	(ada_language::varobj_ops): New member function.
	* c-lang.c (c_language_data): Remove la_varobj_ops
	initializer.
	(cplus_language_data): Likewise.
	(cplus_language::varobj_ops): New member function.
	(asm_language_data): Remove la_varobj_ops initializer.
	(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 (language_defn::varobj_ops): New function.
	(unknown_language_data): Remove la_varobj_ops
	initializer.
	(auto_language_data): Likewise.
	* language.h (language_data): Remove la_varobj_ops field.
	(language_defn::varobj_ops): Declare new member function.
	* m2-lang.c (m2_language_data): Remove la_varobj_ops 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.
	* varobj.c (varobj_create): Update call to varobj_ops.
	* varobj.h (default_varobj_ops): Delete define.
This commit is contained in:
Andrew Burgess 2020-08-04 15:59:52 +01:00
parent 1ac14a0402
commit b63a3f3fc4
15 changed files with 54 additions and 21 deletions

View file

@ -1,3 +1,31 @@
2020-09-16 Andrew Burgess <andrew.burgess@embecosm.com>
* ada-lang.c (ada_language_data): Remove la_varobj_ops
initializer.
(ada_language::varobj_ops): New member function.
* c-lang.c (c_language_data): Remove la_varobj_ops
initializer.
(cplus_language_data): Likewise.
(cplus_language::varobj_ops): New member function.
(asm_language_data): Remove la_varobj_ops initializer.
(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 (language_defn::varobj_ops): New function.
(unknown_language_data): Remove la_varobj_ops
initializer.
(auto_language_data): Likewise.
* language.h (language_data): Remove la_varobj_ops field.
(language_defn::varobj_ops): Declare new member function.
* m2-lang.c (m2_language_data): Remove la_varobj_ops 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.
* varobj.c (varobj_create): Update call to varobj_ops.
* varobj.h (default_varobj_ops): Delete define.
2020-09-16 Andrew Burgess <andrew.burgess@embecosm.com>
* ada-lang.c (ada_language_data): Remove la_macro_expansion

View file

@ -13710,7 +13710,6 @@ extern const struct language_data ada_language_data =
{
&ada_exp_descriptor,
ada_op_print_tab, /* expression operators for printing */
&ada_varobj_ops,
};
/* Class representing the Ada language. */
@ -14202,6 +14201,11 @@ public:
bool store_sym_names_in_linkage_form_p () const override
{ return true; }
/* See language.h. */
const struct lang_varobj_ops *varobj_ops () const override
{ return &ada_varobj_ops; }
protected:
/* See language.h. */

View file

@ -877,7 +877,6 @@ extern const struct language_data c_language_data =
{
&exp_descriptor_c,
c_op_print_tab, /* expression operators for printing */
&c_varobj_ops,
};
/* Class representing the C language. */
@ -988,7 +987,6 @@ extern const struct language_data cplus_language_data =
{
&exp_descriptor_c,
c_op_print_tab, /* expression operators for printing */
&cplus_varobj_ops,
};
/* A class for the C++ language. */
@ -1176,6 +1174,11 @@ public:
enum macro_expansion macro_expansion () const override
{ return macro_expansion_c; }
/* See language.h. */
const struct lang_varobj_ops *varobj_ops () const override
{ return &cplus_varobj_ops; }
protected:
/* See language.h. */
@ -1197,7 +1200,6 @@ extern const struct language_data asm_language_data =
{
&exp_descriptor_c,
c_op_print_tab, /* expression operators for printing */
&default_varobj_ops,
};
/* A class for the ASM language. */
@ -1269,7 +1271,6 @@ extern const struct language_data minimal_language_data =
{
&exp_descriptor_c,
c_op_print_tab, /* expression operators for printing */
&default_varobj_ops,
};
/* A class for the minimal language. */

View file

@ -130,7 +130,6 @@ extern const struct language_data d_language_data =
{
&exp_descriptor_c,
d_op_print_tab, /* Expression operators for printing. */
&default_varobj_ops,
};
/* Class representing the D language. */

View file

@ -488,7 +488,6 @@ extern const struct language_data f_language_data =
{
&exp_descriptor_f,
f_op_print_tab, /* expression operators for printing */
&default_varobj_ops,
};
/* Class representing the Fortran language. */

View file

@ -510,7 +510,6 @@ extern const struct language_data go_language_data =
{
&exp_descriptor_c,
go_op_print_tab, /* Expression operators for printing. */
&default_varobj_ops,
};
/* Class representing the Go language. */

View file

@ -764,6 +764,16 @@ language_defn::get_symbol_name_matcher_inner
return default_symbol_name_matcher;
}
/* See language.h. */
const struct lang_varobj_ops *
language_defn::varobj_ops () const
{
/* The ops for the C language are suitable for the vast majority of the
supported languages. */
return &c_varobj_ops;
}
/* Return true if TYPE is a string type, otherwise return false. This
default implementation only detects TYPE_CODE_STRING. */
@ -800,7 +810,6 @@ extern const struct language_data unknown_language_data =
{
&exp_descriptor_standard,
unk_op_print_tab, /* expression operators for printing */
&default_varobj_ops,
};
/* Class representing the unknown language. */
@ -933,7 +942,6 @@ extern const struct language_data auto_language_data =
{
&exp_descriptor_standard,
unk_op_print_tab, /* expression operators for printing */
&default_varobj_ops,
};
/* Class representing the fake "auto" language. */

View file

@ -176,9 +176,6 @@ struct language_data
/* Table for printing expressions. */
const struct op_print *la_op_print_tab;
/* Various operations on varobj. */
const struct lang_varobj_ops *la_varobj_ops;
};
/* Base class from which all other language classes derive. */
@ -565,6 +562,11 @@ struct language_defn : language_data
virtual enum macro_expansion macro_expansion () const
{ return macro_expansion_no; }
/* Return a structure containing various operations on varobj specific
for this language. */
virtual const struct lang_varobj_ops *varobj_ops () const;
protected:
/* This is the overridable part of the GET_SYMBOL_NAME_MATCHER method.

View file

@ -201,7 +201,6 @@ extern const struct language_data m2_language_data =
{
&exp_descriptor_modula2,
m2_op_print_tab, /* expression operators for printing */
&default_varobj_ops,
};
/* Class representing the M2 language. */

View file

@ -325,7 +325,6 @@ extern const struct language_data objc_language_data =
{
&exp_descriptor_standard,
objc_op_print_tab, /* Expression operators for printing */
&default_varobj_ops,
};
/* Class representing the Objective-C language. */

View file

@ -1008,7 +1008,6 @@ extern const struct language_data opencl_language_data =
{
&exp_descriptor_opencl,
c_op_print_tab, /* expression operators for printing */
&default_varobj_ops,
};
/* Class representing the OpenCL language. */

View file

@ -254,7 +254,6 @@ extern const struct language_data pascal_language_data =
{
&exp_descriptor_standard,
pascal_op_print_tab, /* expression operators for printing */
&default_varobj_ops,
};
/* Class representing the Pascal language. */

View file

@ -1903,7 +1903,6 @@ extern const struct language_data rust_language_data =
{
&exp_descriptor_rust,
c_op_print_tab, /* expression operators for printing */
&default_varobj_ops,
};
/* Class representing the Rust language. */

View file

@ -386,7 +386,7 @@ varobj_create (const char *objname,
}
/* Set language info */
var->root->lang_ops = var->root->exp->language_defn->la_varobj_ops;
var->root->lang_ops = var->root->exp->language_defn->varobj_ops ();
install_new_value (var.get (), value, 1 /* Initial assignment */);

View file

@ -233,8 +233,6 @@ extern const struct lang_varobj_ops c_varobj_ops;
extern const struct lang_varobj_ops cplus_varobj_ops;
extern const struct lang_varobj_ops ada_varobj_ops;
#define default_varobj_ops c_varobj_ops
/* Non-zero if we want to see trace of varobj level stuff. */
extern unsigned int varobjdebug;