+2020-09-16 Andrew Burgess <andrew.burgess@embecosm.com>
+
+ * ada-lang.c (ada_language_data): Remove la_exp_desc initializer.
+ (ada_language::expression_ops): New member function.
+ * c-lang.c (c_language_data): Remove la_exp_desc initializer.
+ (c_language::expression_ops): New member function.
+ (cplus_language_data): Remove la_exp_desc initializer.
+ (cplus_language::expression_ops): New member function.
+ (asm_language_data): Remove la_exp_desc initializer.
+ (asm_language::expression_ops): New member function.
+ (minimal_language_data): Remove la_exp_desc initializer.
+ (minimal_language::expression_ops): New member function.
+ * d-lang.c (d_language_data): Remove la_exp_desc initializer.
+ (d_language::expression_ops): New member function.
+ * eval.c (evaluate_subexp): Update call to expression_ops.
+ * expprint.c (print_subexp): Likewise.
+ (op_name): Likewise.
+ (dump_subexp_body): Likewise.
+ * f-lang.c (f_language_data): Remove la_exp_desc initializer.
+ (f_language::expression_ops): New member function.
+ * go-lang.c (go_language_data): Remove la_exp_desc initializer.
+ (go_language::expression_ops): New member function.
+ * language.c (language_defn::expression_ops): New function.
+ (unknown_language_data): Remove la_exp_desc initializer.
+ (auto_language_data): Likewise.
+ * language.h (language_data): Remove la_exp_desc field.
+ (language_defn::expression_ops): Declare new member function.
+ * m2-lang.c (m2_language_data): Remove la_exp_desc initializer.
+ (m2_language::expression_ops): New member function.
+ * objc-lang.c (objc_language_data): Remove la_exp_desc
+ initializer.
+ * opencl-lang.c (opencl_language_data): Remove la_exp_desc
+ initializer.
+ (opencl_language::expression_ops): New member function.
+ * p-lang.c (pascal_language_data): Remove la_exp_desc initializer.
+ * parse.c (operator_length): Update call to expression_ops.
+ (exp_iterate): Likewise.
+ * rust-lang.c (rust_language_data): Remove la_exp_desc
+ initializer.
+ (ruse_language::expression_ops): New member function.
+
2020-09-16 Andrew Burgess <andrew.burgess@embecosm.com>
* ada-lang.c (ada_language_data): Remove la_varobj_ops
extern const struct language_data ada_language_data =
{
- &ada_exp_descriptor,
ada_op_print_tab, /* expression operators for printing */
};
const struct lang_varobj_ops *varobj_ops () const override
{ return &ada_varobj_ops; }
+ /* See language.h. */
+
+ const struct exp_descriptor *expression_ops () const override
+ { return &ada_exp_descriptor; }
+
protected:
/* See language.h. */
extern const struct language_data c_language_data =
{
- &exp_descriptor_c,
c_op_print_tab, /* expression operators for printing */
};
enum macro_expansion macro_expansion () const override
{ return macro_expansion_c; }
+
+ /* See language.h. */
+
+ const struct exp_descriptor *expression_ops () const override
+ { return &exp_descriptor_c; }
};
/* Single instance of the C language class. */
extern const struct language_data cplus_language_data =
{
- &exp_descriptor_c,
c_op_print_tab, /* expression operators for printing */
};
const struct lang_varobj_ops *varobj_ops () const override
{ return &cplus_varobj_ops; }
+ /* See language.h. */
+
+ const struct exp_descriptor *expression_ops () const override
+ { return &exp_descriptor_c; }
+
protected:
/* See language.h. */
extern const struct language_data asm_language_data =
{
- &exp_descriptor_c,
c_op_print_tab, /* expression operators for printing */
};
enum macro_expansion macro_expansion () const override
{ return macro_expansion_c; }
+
+ /* See language.h. */
+
+ const struct exp_descriptor *expression_ops () const override
+ { return &exp_descriptor_c; }
};
/* The single instance of the ASM language class. */
extern const struct language_data minimal_language_data =
{
- &exp_descriptor_c,
c_op_print_tab, /* expression operators for printing */
};
enum macro_expansion macro_expansion () const override
{ return macro_expansion_c; }
+
+ /* See language.h. */
+
+ const struct exp_descriptor *expression_ops () const override
+ { return &exp_descriptor_c; }
};
/* The single instance of the minimal language class. */
extern const struct language_data d_language_data =
{
- &exp_descriptor_c,
d_op_print_tab, /* Expression operators for printing. */
};
const char *name_of_this () const override
{ return "this"; }
+
+ /* See language.h. */
+
+ const struct exp_descriptor *expression_ops () const override
+ { return &exp_descriptor_c; }
};
/* Single instance of the D language class. */
&& !thread_stack_temporaries_enabled_p (inferior_thread ()))
stack_temporaries.emplace (inferior_thread ());
- retval = (*exp->language_defn->la_exp_desc->evaluate_exp)
+ retval = (*exp->language_defn->expression_ops ()->evaluate_exp)
(expect_type, exp, pos, noside);
if (stack_temporaries.has_value ()
print_subexp (struct expression *exp, int *pos,
struct ui_file *stream, enum precedence prec)
{
- exp->language_defn->la_exp_desc->print_subexp (exp, pos, stream, prec);
+ exp->language_defn->expression_ops ()->print_subexp (exp, pos, stream,
+ prec);
}
/* Standard implementation of print_subexp for use in language_defn
unsigned (opcode));
return cell;
}
- return exp->language_defn->la_exp_desc->op_name (opcode);
+ return exp->language_defn->expression_ops ()->op_name (opcode);
}
/* Default name for the standard operator OPCODE (i.e., one defined in
static int
dump_subexp_body (struct expression *exp, struct ui_file *stream, int elt)
{
- return exp->language_defn->la_exp_desc->dump_subexp_body (exp, stream, elt);
+ return exp->language_defn->expression_ops ()->dump_subexp_body (exp, stream,
+ elt);
}
/* Default value for subexp_body in exp_descriptor vector. */
extern const struct language_data f_language_data =
{
- &exp_descriptor_f,
f_op_print_tab, /* expression operators for printing */
};
enum array_ordering array_ordering () const override
{ return array_column_major; }
+ /* See language.h. */
+
+ const struct exp_descriptor *expression_ops () const override
+ { return &exp_descriptor_f; }
+
protected:
/* See language.h. */
extern const struct language_data go_language_data =
{
- &exp_descriptor_c,
go_op_print_tab, /* Expression operators for printing. */
};
bool store_sym_names_in_linkage_form_p () const override
{ return true; }
+
+ /* See language.h. */
+
+ const struct exp_descriptor *expression_ops () const override
+ { return &exp_descriptor_c; }
};
/* Single instance of the Go language class. */
return &c_varobj_ops;
}
+/* See language.h. */
+
+const struct exp_descriptor *
+language_defn::expression_ops () const
+{
+ return &exp_descriptor_standard;
+}
+
/* Return true if TYPE is a string type, otherwise return false. This
default implementation only detects TYPE_CODE_STRING. */
extern const struct language_data unknown_language_data =
{
- &exp_descriptor_standard,
unk_op_print_tab, /* expression operators for printing */
};
extern const struct language_data auto_language_data =
{
- &exp_descriptor_standard,
unk_op_print_tab, /* expression operators for printing */
};
struct language_data
{
- /* Definitions related to expression printing, prefixifying, and
- dumping. */
-
- const struct exp_descriptor *la_exp_desc;
-
/* Table for printing expressions. */
const struct op_print *la_op_print_tab;
virtual const struct lang_varobj_ops *varobj_ops () const;
+ /* Definitions related to expression printing, prefixifying, and
+ dumping. */
+
+ virtual const struct exp_descriptor *expression_ops () const;
+
protected:
/* This is the overridable part of the GET_SYMBOL_NAME_MATCHER method.
extern const struct language_data m2_language_data =
{
- &exp_descriptor_modula2,
m2_op_print_tab, /* expression operators for printing */
};
bool range_checking_on_by_default () const override
{ return true; }
+
+ /* See language.h. */
+
+ const struct exp_descriptor *expression_ops () const override
+ { return &exp_descriptor_modula2; }
};
/* Single instance of the M2 language. */
extern const struct language_data objc_language_data =
{
- &exp_descriptor_standard,
objc_op_print_tab, /* Expression operators for printing */
};
/* Constant data representing the OpenCL language. */
extern const struct language_data opencl_language_data =
{
- &exp_descriptor_opencl,
c_op_print_tab, /* expression operators for printing */
};
enum macro_expansion macro_expansion () const override
{ return macro_expansion_c; }
+
+ /* See language.h. */
+
+ const struct exp_descriptor *expression_ops () const override
+ { return &exp_descriptor_opencl; }
};
/* Single instance of the OpenCL language class. */
extern const struct language_data pascal_language_data =
{
- &exp_descriptor_standard,
pascal_op_print_tab, /* expression operators for printing */
};
operator_length (const struct expression *expr, int endpos, int *oplenp,
int *argsp)
{
- expr->language_defn->la_exp_desc->operator_length (expr, endpos,
- oplenp, argsp);
+ expr->language_defn->expression_ops ()->operator_length (expr, endpos,
+ oplenp, argsp);
}
/* Default value for operator_length in exp_descriptor vectors. */
gdb_assert (oplen > 0);
pos = endpos - oplen;
- if (exp->language_defn->la_exp_desc->operator_check (exp, pos,
- objfile_func, data))
+ if (exp->language_defn->expression_ops ()->operator_check (exp, pos,
+ objfile_func,
+ data))
return 1;
endpos = pos;
extern const struct language_data rust_language_data =
{
- &exp_descriptor_rust,
c_op_print_tab, /* expression operators for printing */
};
bool range_checking_on_by_default () const override
{ return true; }
+
+ /* See language.h. */
+
+ const struct exp_descriptor *expression_ops () const override
+ { return &exp_descriptor_rust; }
};
/* Single instance of the Rust language class. */