aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndrew Burgess <andrew.burgess@embecosm.com>2020-05-02 10:24:05 +0100
committerAndrew Burgess <andrew.burgess@embecosm.com>2020-06-02 13:53:10 +0100
commitfb8006fd350ad9eba04c19904f9a0fcd47628b41 (patch)
tree85f3e05352415e4fbf978913ff090fa5e9567d2a
parent8e25bafe932b090850854321b816685b2462c17e (diff)
downloadgdb-fb8006fd350ad9eba04c19904f9a0fcd47628b41.zip
gdb-fb8006fd350ad9eba04c19904f9a0fcd47628b41.tar.gz
gdb-fb8006fd350ad9eba04c19904f9a0fcd47628b41.tar.bz2
gdb: Convert language la_search_name_hash field to a method
This commit changes the language_data::la_search_name_hash function pointer member variable into a member function of language_defn. There should be no user visible changes after this commit. gdb/ChangeLog: * ada-lang.c (ada_language_data): Delete la_search_name_hash initializer. * c-lang.c (c_language_data): Likewise. (cplus_language_data): Likewise. (cplus_language::search_name_hash): New member function. (asm_language_data): Delete la_search_name_hash initializer. (minimal_language_data): Likewise. * d-lang.c (d_language_data): Likewise. * dictionary.c (default_search_name_hash): Rename to... (language_defn::search_name_hash): ...this. * f-lang.c (f_language_data): Likewise. (f_language::search_name_hash): New member function. * go-lang.c (go_language_data): Delete la_search_name_hash initializer. * language.c (unknown_language_data): Likewise. (auto_language_data): Likewise. * language.h (struct language_data): Delete la_search_name_hash field. (language_defn::search_name_hash): Declare new member function. (default_search_name_hash): Delete declaration. * m2-lang.c (m2_language_data): Delete la_search_name_hash initializer. * objc-lang.c (objc_language_data): Likewise. * opencl-lang.c (opencl_language_data): Likewise. * p-lang.c (pascal_language_data): Likewise. * rust-lang.c (rust_language_data): Likewise. * symtab.c (search_name_hash): Update call.
-rw-r--r--gdb/ChangeLog30
-rw-r--r--gdb/ada-lang.c1
-rw-r--r--gdb/c-lang.c10
-rw-r--r--gdb/d-lang.c1
-rw-r--r--gdb/dictionary.c2
-rw-r--r--gdb/f-lang.c7
-rw-r--r--gdb/go-lang.c1
-rw-r--r--gdb/language.c2
-rw-r--r--gdb/language.h16
-rw-r--r--gdb/m2-lang.c1
-rw-r--r--gdb/objc-lang.c1
-rw-r--r--gdb/opencl-lang.c1
-rw-r--r--gdb/p-lang.c1
-rw-r--r--gdb/rust-lang.c1
-rw-r--r--gdb/symtab.c2
15 files changed, 47 insertions, 30 deletions
diff --git a/gdb/ChangeLog b/gdb/ChangeLog
index a05b6b1..b8ce903 100644
--- a/gdb/ChangeLog
+++ b/gdb/ChangeLog
@@ -1,5 +1,35 @@
2020-06-02 Andrew Burgess <andrew.burgess@embecosm.com>
+ * ada-lang.c (ada_language_data): Delete la_search_name_hash
+ initializer.
+ * c-lang.c (c_language_data): Likewise.
+ (cplus_language_data): Likewise.
+ (cplus_language::search_name_hash): New member function.
+ (asm_language_data): Delete la_search_name_hash initializer.
+ (minimal_language_data): Likewise.
+ * d-lang.c (d_language_data): Likewise.
+ * dictionary.c (default_search_name_hash): Rename to...
+ (language_defn::search_name_hash): ...this.
+ * f-lang.c (f_language_data): Likewise.
+ (f_language::search_name_hash): New member function.
+ * go-lang.c (go_language_data): Delete la_search_name_hash
+ initializer.
+ * language.c (unknown_language_data): Likewise.
+ (auto_language_data): Likewise.
+ * language.h (struct language_data): Delete la_search_name_hash
+ field.
+ (language_defn::search_name_hash): Declare new member function.
+ (default_search_name_hash): Delete declaration.
+ * m2-lang.c (m2_language_data): Delete la_search_name_hash
+ initializer.
+ * objc-lang.c (objc_language_data): Likewise.
+ * opencl-lang.c (opencl_language_data): Likewise.
+ * p-lang.c (pascal_language_data): Likewise.
+ * rust-lang.c (rust_language_data): Likewise.
+ * symtab.c (search_name_hash): Update call.
+
+2020-06-02 Andrew Burgess <andrew.burgess@embecosm.com>
+
* ada-lang.c (ada_language_data): Delete la_get_compile_instance
initializer.
* c-lang.c (class compile_instance): Declare.
diff --git a/gdb/ada-lang.c b/gdb/ada-lang.c
index f0f5ee5..0232f6b 100644
--- a/gdb/ada-lang.c
+++ b/gdb/ada-lang.c
@@ -13977,7 +13977,6 @@ extern const struct language_data ada_language_data =
ada_collect_symbol_completion_matches,
ada_watch_location_expression,
ada_get_symbol_name_matcher, /* la_get_symbol_name_matcher */
- default_search_name_hash,
&ada_varobj_ops,
NULL,
ada_is_string_type,
diff --git a/gdb/c-lang.c b/gdb/c-lang.c
index eb9ebdb..8452760 100644
--- a/gdb/c-lang.c
+++ b/gdb/c-lang.c
@@ -924,7 +924,6 @@ extern const struct language_data c_language_data =
default_collect_symbol_completion_matches,
c_watch_location_expression,
NULL, /* la_get_symbol_name_matcher */
- default_search_name_hash,
&c_varobj_ops,
c_compute_program,
c_is_string_type_p,
@@ -1028,7 +1027,6 @@ extern const struct language_data cplus_language_data =
default_collect_symbol_completion_matches,
c_watch_location_expression,
cp_get_symbol_name_matcher,
- cp_search_name_hash,
&cplus_varobj_ops,
cplus_compute_program,
c_is_string_type_p,
@@ -1126,6 +1124,12 @@ public:
{
return cplus_get_compile_context ();
}
+
+ /* See language.h. */
+ unsigned int search_name_hash (const char *name) const override
+ {
+ return cp_search_name_hash (name);
+ }
};
/* The single instance of the C++ language class. */
@@ -1174,7 +1178,6 @@ extern const struct language_data asm_language_data =
default_collect_symbol_completion_matches,
c_watch_location_expression,
NULL, /* la_get_symbol_name_matcher */
- default_search_name_hash,
&default_varobj_ops,
NULL,
c_is_string_type_p,
@@ -1243,7 +1246,6 @@ extern const struct language_data minimal_language_data =
default_collect_symbol_completion_matches,
c_watch_location_expression,
NULL, /* la_get_symbol_name_matcher */
- default_search_name_hash,
&default_varobj_ops,
NULL,
c_is_string_type_p,
diff --git a/gdb/d-lang.c b/gdb/d-lang.c
index 08b884d..c6ee6a2 100644
--- a/gdb/d-lang.c
+++ b/gdb/d-lang.c
@@ -176,7 +176,6 @@ extern const struct language_data d_language_data =
default_collect_symbol_completion_matches,
c_watch_location_expression,
NULL, /* la_get_symbol_name_matcher */
- default_search_name_hash,
&default_varobj_ops,
NULL,
c_is_string_type_p,
diff --git a/gdb/dictionary.c b/gdb/dictionary.c
index 0e873b6..da44946 100644
--- a/gdb/dictionary.c
+++ b/gdb/dictionary.c
@@ -719,7 +719,7 @@ expand_hashtable (struct dictionary *dict)
/* See dictionary.h. */
unsigned int
-default_search_name_hash (const char *string0)
+language_defn::search_name_hash (const char *string0) const
{
/* The Ada-encoded version of a name P1.P2...Pn has either the form
P1__P2__...Pn<suffix> or _ada_P1__P2__...Pn<suffix> (where the Pi
diff --git a/gdb/f-lang.c b/gdb/f-lang.c
index 9e647f5..a2df46a 100644
--- a/gdb/f-lang.c
+++ b/gdb/f-lang.c
@@ -633,7 +633,6 @@ extern const struct language_data f_language_data =
f_collect_symbol_completion_matches,
c_watch_location_expression,
cp_get_symbol_name_matcher, /* la_get_symbol_name_matcher */
- cp_search_name_hash,
&default_varobj_ops,
NULL,
f_is_string_type_p,
@@ -686,6 +685,12 @@ public:
lai->bool_type_symbol = "logical";
lai->bool_type_default = builtin->builtin_logical_s2;
}
+
+ /* See language.h. */
+ unsigned int search_name_hash (const char *name) const override
+ {
+ return cp_search_name_hash (name);
+ }
};
/* Single instance of the Fortran language class. */
diff --git a/gdb/go-lang.c b/gdb/go-lang.c
index 8f9ea63..8491c97 100644
--- a/gdb/go-lang.c
+++ b/gdb/go-lang.c
@@ -561,7 +561,6 @@ extern const struct language_data go_language_data =
default_collect_symbol_completion_matches,
c_watch_location_expression,
NULL, /* la_get_symbol_name_matcher */
- default_search_name_hash,
&default_varobj_ops,
NULL,
go_is_string_type_p,
diff --git a/gdb/language.c b/gdb/language.c
index 941e0df..7a87134 100644
--- a/gdb/language.c
+++ b/gdb/language.c
@@ -838,7 +838,6 @@ extern const struct language_data unknown_language_data =
default_collect_symbol_completion_matches,
c_watch_location_expression,
NULL, /* la_get_symbol_name_matcher */
- default_search_name_hash,
&default_varobj_ops,
NULL,
default_is_string_type_p,
@@ -903,7 +902,6 @@ extern const struct language_data auto_language_data =
default_collect_symbol_completion_matches,
c_watch_location_expression,
NULL, /* la_get_symbol_name_matcher */
- default_search_name_hash,
&default_varobj_ops,
NULL,
default_is_string_type_p,
diff --git a/gdb/language.h b/gdb/language.h
index 57f0adb..5233c0f 100644
--- a/gdb/language.h
+++ b/gdb/language.h
@@ -384,11 +384,6 @@ struct language_data
symbol_name_matcher_ftype *(*la_get_symbol_name_matcher)
(const lookup_name_info &);
- /* Hash the given symbol search name. Use
- default_search_name_hash if no special treatment is
- required. */
- unsigned int (*la_search_name_hash) (const char *name);
-
/* Various operations on varobj. */
const struct lang_varobj_ops *la_varobj_ops;
@@ -514,6 +509,9 @@ struct language_defn : language_data
return nullptr;
}
+ /* Hash the given symbol search name. */
+ virtual unsigned int search_name_hash (const char *name) const;
+
/* List of all known languages. */
static const struct language_defn *languages[nr_languages];
};
@@ -690,14 +688,6 @@ struct language_pass_by_ref_info language_pass_by_reference (struct type *type);
void default_print_typedef (struct type *type, struct symbol *new_symbol,
struct ui_file *stream);
-/* Default name hashing function. */
-
-/* Produce an unsigned hash value from SEARCH_NAME that is consistent
- with strcmp_iw, strcmp, and, at least on Ada symbols, wild_match.
- That is, two identifiers equivalent according to any of those three
- comparison operators hash to the same value. */
-extern unsigned int default_search_name_hash (const char *search_name);
-
void c_get_string (struct value *value,
gdb::unique_xmalloc_ptr<gdb_byte> *buffer,
int *length, struct type **char_type,
diff --git a/gdb/m2-lang.c b/gdb/m2-lang.c
index 21cafb9..2166470 100644
--- a/gdb/m2-lang.c
+++ b/gdb/m2-lang.c
@@ -386,7 +386,6 @@ extern const struct language_data m2_language_data =
default_collect_symbol_completion_matches,
c_watch_location_expression,
NULL, /* la_get_symbol_name_matcher */
- default_search_name_hash,
&default_varobj_ops,
NULL,
m2_is_string_type_p,
diff --git a/gdb/objc-lang.c b/gdb/objc-lang.c
index 4a84f84..afbb1fb 100644
--- a/gdb/objc-lang.c
+++ b/gdb/objc-lang.c
@@ -401,7 +401,6 @@ extern const struct language_data objc_language_data =
default_collect_symbol_completion_matches,
c_watch_location_expression,
NULL, /* la_get_symbol_name_matcher */
- default_search_name_hash,
&default_varobj_ops,
NULL,
c_is_string_type_p,
diff --git a/gdb/opencl-lang.c b/gdb/opencl-lang.c
index bfb462c..a3a51a5 100644
--- a/gdb/opencl-lang.c
+++ b/gdb/opencl-lang.c
@@ -1061,7 +1061,6 @@ extern const struct language_data opencl_language_data =
default_collect_symbol_completion_matches,
c_watch_location_expression,
NULL, /* la_get_symbol_name_matcher */
- default_search_name_hash,
&default_varobj_ops,
NULL,
c_is_string_type_p,
diff --git a/gdb/p-lang.c b/gdb/p-lang.c
index f040f9a..5d8c816 100644
--- a/gdb/p-lang.c
+++ b/gdb/p-lang.c
@@ -416,7 +416,6 @@ extern const struct language_data pascal_language_data =
default_collect_symbol_completion_matches,
c_watch_location_expression,
NULL, /* la_compare_symbol_for_completion */
- default_search_name_hash,
&default_varobj_ops,
NULL,
pascal_is_string_type_p,
diff --git a/gdb/rust-lang.c b/gdb/rust-lang.c
index fbc454c..26e2ad5 100644
--- a/gdb/rust-lang.c
+++ b/gdb/rust-lang.c
@@ -2093,7 +2093,6 @@ extern const struct language_data rust_language_data =
default_collect_symbol_completion_matches,
rust_watch_location_expression,
NULL, /* la_get_symbol_name_matcher */
- default_search_name_hash,
&default_varobj_ops,
NULL,
rust_is_string_type_p,
diff --git a/gdb/symtab.c b/gdb/symtab.c
index f333ea6..aa3d84a 100644
--- a/gdb/symtab.c
+++ b/gdb/symtab.c
@@ -1855,7 +1855,7 @@ demangle_for_lookup (const char *name, enum language lang,
unsigned int
search_name_hash (enum language language, const char *search_name)
{
- return language_def (language)->la_search_name_hash (search_name);
+ return language_def (language)->search_name_hash (search_name);
}
/* See symtab.h.