aboutsummaryrefslogtreecommitdiff
path: root/gdb/d-lang.c
diff options
context:
space:
mode:
authorAndrew Burgess <andrew.burgess@embecosm.com>2020-05-13 18:04:30 +0100
committerAndrew Burgess <andrew.burgess@embecosm.com>2020-06-02 13:53:11 +0100
commit6f8270197a2909607f2c076018e30677bbac652e (patch)
tree890b5a01405272f8935e6daa508c7697f37c51c6 /gdb/d-lang.c
parentfb8006fd350ad9eba04c19904f9a0fcd47628b41 (diff)
downloadgdb-6f8270197a2909607f2c076018e30677bbac652e.zip
gdb-6f8270197a2909607f2c076018e30677bbac652e.tar.gz
gdb-6f8270197a2909607f2c076018e30677bbac652e.tar.bz2
gdb: Convert language la_sniff_from_mangled_name field to a method
This commit changes the language_data::la_sniff_from_mangled_name function pointer member variable into a member function of language_defn. Previously the la_sniff_from_mangled_name pointer was NULL for some languages, however, all uses of this function pointer were through the function language_sniff_from_mangled_name which provided a default implementation. This default implementation now becomes the implementation in the base class language_defn, which is then overridden as required in various language sub-classes. There should be no user visible changes after this commit. gdb/ChangeLog: * ada-lang.c (ada_sniff_from_mangled_name): Delete function, implementation moves to... (ada_language::sniff_from_mangled_name): ...here. Update return type. (ada_language_data): Delete la_sniff_from_mangled_name initializer. * c-lang.c (c_language_data): Likewise. (cplus_language_data): Likewise. (cplus_language::sniff_from_mangled_name): New member function, implementation taken from gdb_sniff_from_mangled_name. (asm_language_data): Delete la_sniff_from_mangled_name initializer. (minimal_language_data): Likewise. * cp-support.c (gdb_sniff_from_mangled_name): Delete, implementation moves to cplus_language::sniff_from_mangled_name. * cp-support.h (gdb_sniff_from_mangled_name): Delete declaration. * d-lang.c (d_sniff_from_mangled_name): Delete, implementation moves to... (d_language::sniff_from_mangled_name): ...here. (d_language_data): Delete la_sniff_from_mangled_name initializer. * f-lang.c (f_language_data): Likewise. * go-lang.c (go_sniff_from_mangled_name): Delete, implementation moves to... (go_language::sniff_from_mangled_name): ...here. (go_language_data): Delete la_sniff_from_mangled_name initializer. * language.c (language_sniff_from_mangled_name): Delete. (unknown_language_data): Delete la_sniff_from_mangled_name initializer. (auto_language_data): Likewise. * language.h (language_data): Delete la_sniff_from_mangled_name field. (language_defn::sniff_from_mangled_name): New function. (language_sniff_from_mangled_name): Delete declaration. * m2-lang.c (m2_language_data): Delete la_sniff_from_mangled_name field. * objc-lang.c (objc_sniff_from_mangled_name): Delete, implementation moves to... (objc_language::sniff_from_mangled_name): ...here. (objc_language_data): Delete la_sniff_from_mangled_name initializer. * opencl-lang.c (opencl_language_data): Likewise. * p-lang.c (pascal_language_data): Likewise. * rust-lang.c (rust_sniff_from_mangled_name): Delete, implementation moves to... (rust_language::sniff_from_mangled_name): ...here. (rust_language_data): Delete la_sniff_from_mangled_name initializer. * symtab.c (symbol_find_demangled_name): Call sniff_from_mangled_name member function.
Diffstat (limited to 'gdb/d-lang.c')
-rw-r--r--gdb/d-lang.c18
1 files changed, 8 insertions, 10 deletions
diff --git a/gdb/d-lang.c b/gdb/d-lang.c
index c6ee6a2..23b9464 100644
--- a/gdb/d-lang.c
+++ b/gdb/d-lang.c
@@ -56,15 +56,6 @@ d_demangle (const char *symbol, int options)
return gdb_demangle (symbol, options | DMGL_DLANG);
}
-/* la_sniff_from_mangled_name implementation for D. */
-
-static int
-d_sniff_from_mangled_name (const char *mangled, char **demangled)
-{
- *demangled = d_demangle (mangled, 0);
- return *demangled != NULL;
-}
-
/* Table mapping opcodes into strings for printing operators
and precedences of the operators. */
static const struct op_print d_op_print_tab[] =
@@ -166,7 +157,6 @@ extern const struct language_data d_language_data =
false, /* la_store_sym_names_in_linkage_form_p */
d_lookup_symbol_nonlocal,
d_demangle, /* Language specific symbol demangler. */
- d_sniff_from_mangled_name,
NULL, /* Language specific
class_name_from_physname. */
d_op_print_tab, /* Expression operators for printing. */
@@ -254,6 +244,14 @@ public:
lai->bool_type_symbol = "bool";
lai->bool_type_default = builtin->builtin_bool;
}
+
+ /* See language.h. */
+ bool sniff_from_mangled_name (const char *mangled,
+ char **demangled) const override
+ {
+ *demangled = d_demangle (mangled, 0);
+ return *demangled != NULL;
+ }
};
/* Single instance of the D language class. */