diff options
author | Andrew Burgess <andrew.burgess@embecosm.com> | 2020-05-13 18:04:30 +0100 |
---|---|---|
committer | Andrew Burgess <andrew.burgess@embecosm.com> | 2020-06-02 13:53:11 +0100 |
commit | 6f8270197a2909607f2c076018e30677bbac652e (patch) | |
tree | 890b5a01405272f8935e6daa508c7697f37c51c6 /gdb/language.h | |
parent | fb8006fd350ad9eba04c19904f9a0fcd47628b41 (diff) | |
download | gdb-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/language.h')
-rw-r--r-- | gdb/language.h | 44 |
1 files changed, 21 insertions, 23 deletions
diff --git a/gdb/language.h b/gdb/language.h index 5233c0f..d5013bf 100644 --- a/gdb/language.h +++ b/gdb/language.h @@ -318,22 +318,6 @@ struct language_data /* Return demangled language symbol, or NULL. */ char *(*la_demangle) (const char *mangled, int options); - /* Demangle a symbol according to this language's rules. Unlike - la_demangle, this does not take any options. - - *DEMANGLED will be set by this function. - - If this function returns 0, then *DEMANGLED must always be set - to NULL. - - If this function returns 1, the implementation may set this to - a xmalloc'd string holding the demangled form. However, it is - not required to. The string, if any, is owned by the caller. - - The resulting string should be of the form that will be - installed into a symbol. */ - int (*la_sniff_from_mangled_name) (const char *mangled, char **demangled); - /* Return class name of a mangled method name or NULL. */ char *(*la_class_name_from_physname) (const char *physname); @@ -512,6 +496,27 @@ struct language_defn : language_data /* Hash the given symbol search name. */ virtual unsigned int search_name_hash (const char *name) const; + /* Demangle a symbol according to this language's rules. Unlike + la_demangle, this does not take any options. + + *DEMANGLED will be set by this function. + + If this function returns false, then *DEMANGLED must always be set + to NULL. + + If this function returns true, the implementation may set this to + a xmalloc'd string holding the demangled form. However, it is + not required to. The string, if any, is owned by the caller. + + The resulting string should be of the form that will be + installed into a symbol. */ + virtual bool sniff_from_mangled_name (const char *mangled, + char **demangled) const + { + *demangled = nullptr; + return false; + } + /* List of all known languages. */ static const struct language_defn *languages[nr_languages]; }; @@ -666,13 +671,6 @@ extern CORE_ADDR skip_language_trampoline (struct frame_info *, CORE_ADDR pc); extern char *language_demangle (const struct language_defn *current_language, const char *mangled, int options); -/* A wrapper for la_sniff_from_mangled_name. The arguments and result - are as for the method. */ - -extern int language_sniff_from_mangled_name (const struct language_defn *lang, - const char *mangled, - char **demangled); - /* Return class name from physname, or NULL. */ extern char *language_class_name_from_physname (const struct language_defn *, const char *physname); |