diff options
author | Andrew Burgess <andrew.burgess@embecosm.com> | 2020-05-14 19:03:45 +0100 |
---|---|---|
committer | Andrew Burgess <andrew.burgess@embecosm.com> | 2020-06-02 13:53:11 +0100 |
commit | 0a50df5dabfe12c8bf20f4f724622ff38ef7828b (patch) | |
tree | 94db36b29dc0e23875a6b604d07338a12962fe82 /gdb/language.c | |
parent | fbfb0a463fc7de88a2da8858ac5cd6c2f4796514 (diff) | |
download | gdb-0a50df5dabfe12c8bf20f4f724622ff38ef7828b.zip gdb-0a50df5dabfe12c8bf20f4f724622ff38ef7828b.tar.gz gdb-0a50df5dabfe12c8bf20f4f724622ff38ef7828b.tar.bz2 |
gdb: Convert language la_demangle field to a method
This commit changes the language_data::la_demangle function pointer
member variable into a member function of language_defn.
The only slightly "weird" change in this commit is in f-lang.c, where
I have given the Fortran language a demangle method that is identical
to the default language_defn::demangle. The only reason for this is
to give me somewhere to copy the comment that was previously embedded
within the f_language_data structure.
There should be no user visible changes after this commit.
gdb/ChangeLog:
* ada-lang.c (ada_language_data): Delete la_demangle initializer.
(ada_language::demangle): New member function.
* c-lang.c (c_language_data): Delete la_demangle initializer.
(cplus_language_data): Delete la_demangle initializer.
(cplus_language::demangle): New member function.
(asm_language_data): Delete la_demangle initializer.
(minimal_language_data): Delete la_demangle initializer.
* d-lang.c (d_language_data): Delete la_demangle initializer.
(d_language::demangle): New member function.
* f-lang.c (f_language_data): Delete la_demangle initializer.
(f_language::demangle): New member function.
* go-lang.c (go_language_data): Delete la_demangle initializer.
(go_language::demangle): New member function.
* language.c (language_demangle): Update.
(unk_lang_demangle): Delete.
(unknown_language_data): Delete la_demangle initializer.
(unknown_language::demangle): New member function.
(auto_language_data): Delete la_demangle initializer.
(auto_language::demangle): New member function.
* language.h (language_data): Delete la_demangle field.
(language_defn::demangle): New function.
* m2-lang.c (m2_language_data): Delete la_demangle initializer.
* objc-lang.c (objc_language_data): Delete la_demangle
initializer.
(objc_language::demangle): New member function.
* opencl-lang.c (opencl_language_data): Delete la_demangle
initializer.
* p-lang.c (pascal_language_data): Likewise.
* rust-lang.c (rust_language_data): Likewise.
(rust_language::demangle): New member functi
Diffstat (limited to 'gdb/language.c')
-rw-r--r-- | gdb/language.c | 28 |
1 files changed, 18 insertions, 10 deletions
diff --git a/gdb/language.c b/gdb/language.c index c8f0349..c447eab 100644 --- a/gdb/language.c +++ b/gdb/language.c @@ -589,8 +589,8 @@ char * language_demangle (const struct language_defn *current_language, const char *mangled, int options) { - if (current_language != NULL && current_language->la_demangle) - return current_language->la_demangle (mangled, options); + if (current_language != NULL) + return current_language->demangle (mangled, options); return NULL; } @@ -749,12 +749,6 @@ static CORE_ADDR unk_lang_trampoline (struct frame_info *frame, CORE_ADDR pc) return 0; } -/* Unknown languages just use the cplus demangler. */ -static char *unk_lang_demangle (const char *mangled, int options) -{ - return gdb_demangle (mangled, options); -} - static char *unk_lang_class_name (const char *mangled) { return NULL; @@ -800,7 +794,6 @@ extern const struct language_data unknown_language_data = "this", /* name_of_this */ true, /* store_sym_names_in_linkage_form_p */ basic_lookup_symbol_nonlocal, /* lookup_symbol_nonlocal */ - unk_lang_demangle, /* Language specific symbol demangler */ unk_lang_class_name, /* Language specific class_name_from_physname */ unk_op_print_tab, /* expression operators for printing */ @@ -840,6 +833,14 @@ public: { error (_("unimplemented unknown_language::print_type called")); } + + /* See language.h. */ + + char *demangle (const char *mangled, int options) const override + { + /* The unknown language just uses the C++ demangler. */ + return gdb_demangle (mangled, options); + } }; /* Single instance of the unknown language class. */ @@ -871,7 +872,6 @@ extern const struct language_data auto_language_data = "this", /* name_of_this */ false, /* store_sym_names_in_linkage_form_p */ basic_lookup_symbol_nonlocal, /* lookup_symbol_nonlocal */ - unk_lang_demangle, /* Language specific symbol demangler */ unk_lang_class_name, /* Language specific class_name_from_physname */ unk_op_print_tab, /* expression operators for printing */ @@ -911,6 +911,14 @@ public: { error (_("unimplemented auto_language::print_type called")); } + + /* See language.h. */ + + char *demangle (const char *mangled, int options) const override + { + /* The auto language just uses the C++ demangler. */ + return gdb_demangle (mangled, options); + } }; /* Single instance of the fake "auto" language. */ |