+2020-09-16 Andrew Burgess <andrew.burgess@embecosm.com>
+
+ * ada-lang.c (ada_language_data): Remove la_name_of_this
+ initializer.
+ * ax-gdb.c (gen_expr): Update call to name_of_this.
+ * c-exp.y (classify_name): Likewise.
+ * c-lang.c (c_language_data): Remove la_name_of_this initializer.
+ (cplus_language_data): Likewise.
+ (cplus_language::name_of_this): New member function.
+ (asm_language_data): Remove la_name_of_this initializer.
+ (minimal_language_data): Likewise.
+ * d-lang.c (d_language_data): Likewise.
+ (d_language::name_of_this): New member function.
+ * expprint.c (print_subexp_standard): Update call to name_of_this.
+ * f-lang.c (f_language_data): Remove la_name_of_this initializer.
+ * go-lang.c (go_language_data): Likewise.
+ * language.c (unknown_language_data): Likewise.
+ (unknown_language::name_of_this): New member function.
+ (auto_language_data): Remove la_name_of_this initializer.
+ (auto_language::name_of_this): New member function.
+ * language.h (language_data): Delete la_name_of_this member
+ variable.
+ (language_defn::name_of_this): New member function.
+ * m2-lang.c (m2_language_data): Remove la_name_of_this
+ initializer.
+ * objc-lang.c (objc_language_data): Likewise.
+ (objc_language::name_of_this): New member function.
+ * opencl-lang.c (opencl_language_data): Remove la_name_of_this
+ initializer.
+ * p-lang.c (pascal_language_data): Likewise.
+ (pascal_language::name_of_this): New member function.
+ * rust-lang.c (rust_language_data): Remove la_name_of_this
+ initializer.
+ * symtab.c (lookup_language_this): Update call to name_of_this.
+ (lookup_symbol_aux): Likewise.
+ * valops.c (value_of_this): Likewise.
+
2020-09-16 Andrew Burgess <andrew.burgess@embecosm.com>
* ada-lang.c (ada_language_data): Remove
macro_expansion_no,
ada_extensions,
&ada_exp_descriptor,
- NULL, /* name_of_this */
true, /* la_store_sym_names_in_linkage_form_p */
ada_op_print_tab, /* expression operators for printing */
0, /* c-style arrays */
sym = lookup_language_this (lang, b).symbol;
if (!sym)
- error (_("no `%s' found"), lang->la_name_of_this);
+ error (_("no `%s' found"), lang->name_of_this ());
gen_var_ref (ax, value, sym);
memset (&is_a_field_of_this, 0, sizeof (is_a_field_of_this));
bsym = lookup_symbol (copy.c_str (), block, VAR_DOMAIN,
- par_state->language ()->la_name_of_this
+ par_state->language ()->name_of_this ()
? &is_a_field_of_this : NULL);
if (bsym.symbol && SYMBOL_CLASS (bsym.symbol) == LOC_BLOCK)
macro_expansion_c,
c_extensions,
&exp_descriptor_c,
- NULL, /* name_of_this */
true, /* la_store_sym_names_in_linkage_form_p */
c_op_print_tab, /* expression operators for printing */
1, /* c-style arrays */
macro_expansion_c,
cplus_extensions,
&exp_descriptor_c,
- "this", /* name_of_this */
false, /* la_store_sym_names_in_linkage_form_p */
c_op_print_tab, /* expression operators for printing */
1, /* c-style arrays */
return cp_lookup_symbol_nonlocal (this, name, block, domain);
}
+ /* See language.h. */
+
+ const char *name_of_this () const override
+ { return "this"; }
+
protected:
/* See language.h. */
macro_expansion_c,
asm_extensions,
&exp_descriptor_c,
- NULL, /* name_of_this */
true, /* la_store_sym_names_in_linkage_form_p */
c_op_print_tab, /* expression operators for printing */
1, /* c-style arrays */
macro_expansion_c,
NULL,
&exp_descriptor_c,
- NULL, /* name_of_this */
true, /* la_store_sym_names_in_linkage_form_p */
c_op_print_tab, /* expression operators for printing */
1, /* c-style arrays */
macro_expansion_no,
d_extensions,
&exp_descriptor_c,
- "this",
false, /* la_store_sym_names_in_linkage_form_p */
d_op_print_tab, /* Expression operators for printing. */
1, /* C-style arrays. */
{
return d_parse (ps);
}
+
+ /* See language.h. */
+
+ const char *name_of_this () const override
+ { return "this"; }
};
/* Single instance of the D language class. */
case OP_THIS:
++(*pos);
- if (exp->language_defn->la_name_of_this)
- fputs_filtered (exp->language_defn->la_name_of_this, stream);
+ if (exp->language_defn->name_of_this () != NULL)
+ fputs_filtered (exp->language_defn->name_of_this (), stream);
else
fprintf_styled (stream, metadata_style.style (),
_("<language %s has no 'this'>"),
macro_expansion_no,
f_extensions,
&exp_descriptor_f,
- NULL, /* name_of_this */
false, /* la_store_sym_names_in_linkage_form_p */
f_op_print_tab, /* expression operators for printing */
0, /* arrays are first-class (not c-style) */
macro_expansion_no,
NULL,
&exp_descriptor_c,
- NULL, /* name_of_this */
false, /* la_store_sym_names_in_linkage_form_p */
go_op_print_tab, /* Expression operators for printing. */
1, /* C-style arrays. */
macro_expansion_no,
NULL,
&exp_descriptor_standard,
- "this", /* name_of_this */
true, /* store_sym_names_in_linkage_form_p */
unk_op_print_tab, /* expression operators for printing */
1, /* c-style arrays */
{
return default_is_string_type_p (type);
}
+
+ /* See language.h. */
+
+ const char *name_of_this () const override
+ { return "this"; }
};
/* Single instance of the unknown language class. */
macro_expansion_no,
NULL,
&exp_descriptor_standard,
- "this", /* name_of_this */
false, /* store_sym_names_in_linkage_form_p */
unk_op_print_tab, /* expression operators for printing */
1, /* c-style arrays */
{
return default_is_string_type_p (type);
}
+
+ /* See language.h. */
+
+ const char *name_of_this () const override
+ { return "this"; }
};
/* Single instance of the fake "auto" language. */
/* Now come some hooks for lookup_symbol. */
- /* If this is non-NULL, specifies the name that of the implicit
- local variable that refers to the current object instance. */
-
- const char *la_name_of_this;
-
/* True if the symbols names should be stored in GDB's data structures
for minimal/partial/full symbols using their linkage (aka mangled)
form; false if the symbol names should be demangled first.
virtual const char *struct_too_deep_ellipsis () const
{ return "{...}"; }
+ /* If this returns non-NULL then the string returned specifies the name
+ of the implicit local variable that refers to the current object
+ instance. Return NULL (the default) for languages that have no name
+ for the current object instance. */
+
+ virtual const char *name_of_this () const
+ { return nullptr; }
+
protected:
/* This is the overridable part of the GET_SYMBOL_NAME_MATCHER method.
macro_expansion_no,
NULL,
&exp_descriptor_modula2,
- NULL, /* name_of_this */
false, /* la_store_sym_names_in_linkage_form_p */
m2_op_print_tab, /* expression operators for printing */
0, /* arrays are first-class (not c-style) */
macro_expansion_c,
objc_extensions,
&exp_descriptor_standard,
- "self", /* name_of_this */
false, /* la_store_sym_names_in_linkage_form_p */
objc_op_print_tab, /* Expression operators for printing */
1, /* C-style arrays */
return real_stop_pc;
}
+
+ /* See language.h. */
+
+ const char *name_of_this () const override
+ { return "self"; }
};
/* Single instance of the class representing the Objective-C language. */
macro_expansion_c,
NULL,
&exp_descriptor_opencl,
- NULL, /* name_of_this */
false, /* la_store_sym_names_in_linkage_form_p */
c_op_print_tab, /* expression operators for printing */
1, /* c-style arrays */
macro_expansion_no,
p_extensions,
&exp_descriptor_standard,
- "this", /* name_of_this */
false, /* la_store_sym_names_in_linkage_form_p */
pascal_op_print_tab, /* expression operators for printing */
1, /* c-style arrays */
return is_pascal_string_type (type, nullptr, nullptr, nullptr,
nullptr, nullptr) > 0;
}
+
+ /* See language.h. */
+
+ const char *name_of_this () const override
+ { return "this"; }
};
/* Single instance of the Pascal language class. */
macro_expansion_no,
rust_extensions,
&exp_descriptor_rust,
- NULL, /* name_of_this */
false, /* la_store_sym_names_in_linkage_form_p */
c_op_print_tab, /* expression operators for printing */
1, /* c-style arrays */
lookup_language_this (const struct language_defn *lang,
const struct block *block)
{
- if (lang->la_name_of_this == NULL || block == NULL)
+ if (lang->name_of_this () == NULL || block == NULL)
return {};
if (symbol_lookup_debug > 1)
{
struct symbol *sym;
- sym = block_lookup_symbol (block, lang->la_name_of_this,
+ sym = block_lookup_symbol (block, lang->name_of_this (),
symbol_name_match_type::SEARCH_NAME,
VAR_DOMAIN);
if (sym != NULL)
if (t->code () != TYPE_CODE_STRUCT
&& t->code () != TYPE_CODE_UNION)
error (_("Internal error: `%s' is not an aggregate"),
- langdef->la_name_of_this);
+ langdef->name_of_this ());
if (check_field (t, name, is_a_field_of_this))
{
const struct block *b;
struct frame_info *frame;
- if (!lang->la_name_of_this)
+ if (lang->name_of_this () == NULL)
error (_("no `this' in current language"));
frame = get_selected_frame (_("no frame selected"));
sym = lookup_language_this (lang, b);
if (sym.symbol == NULL)
error (_("current stack frame does not contain a variable named `%s'"),
- lang->la_name_of_this);
+ lang->name_of_this ());
return read_var_value (sym.symbol, sym.block, frame);
}