+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
{
&ada_exp_descriptor,
ada_op_print_tab, /* expression operators for printing */
- &ada_varobj_ops,
};
/* Class representing the Ada language. */
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. */
{
&exp_descriptor_c,
c_op_print_tab, /* expression operators for printing */
- &c_varobj_ops,
};
/* Class representing the C language. */
{
&exp_descriptor_c,
c_op_print_tab, /* expression operators for printing */
- &cplus_varobj_ops,
};
/* A class for the C++ language. */
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. */
{
&exp_descriptor_c,
c_op_print_tab, /* expression operators for printing */
- &default_varobj_ops,
};
/* A class for the ASM language. */
{
&exp_descriptor_c,
c_op_print_tab, /* expression operators for printing */
- &default_varobj_ops,
};
/* A class for the minimal language. */
{
&exp_descriptor_c,
d_op_print_tab, /* Expression operators for printing. */
- &default_varobj_ops,
};
/* Class representing the D language. */
{
&exp_descriptor_f,
f_op_print_tab, /* expression operators for printing */
- &default_varobj_ops,
};
/* Class representing the Fortran language. */
{
&exp_descriptor_c,
go_op_print_tab, /* Expression operators for printing. */
- &default_varobj_ops,
};
/* Class representing the Go language. */
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. */
{
&exp_descriptor_standard,
unk_op_print_tab, /* expression operators for printing */
- &default_varobj_ops,
};
/* Class representing the unknown language. */
{
&exp_descriptor_standard,
unk_op_print_tab, /* expression operators for printing */
- &default_varobj_ops,
};
/* Class representing the fake "auto" language. */
/* 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. */
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.
{
&exp_descriptor_modula2,
m2_op_print_tab, /* expression operators for printing */
- &default_varobj_ops,
};
/* Class representing the M2 language. */
{
&exp_descriptor_standard,
objc_op_print_tab, /* Expression operators for printing */
- &default_varobj_ops,
};
/* Class representing the Objective-C language. */
{
&exp_descriptor_opencl,
c_op_print_tab, /* expression operators for printing */
- &default_varobj_ops,
};
/* Class representing the OpenCL language. */
{
&exp_descriptor_standard,
pascal_op_print_tab, /* expression operators for printing */
- &default_varobj_ops,
};
/* Class representing the Pascal language. */
{
&exp_descriptor_rust,
c_op_print_tab, /* expression operators for printing */
- &default_varobj_ops,
};
/* Class representing the Rust language. */
}
/* 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 */);
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;