aboutsummaryrefslogtreecommitdiff
path: root/gdb/completer.c
diff options
context:
space:
mode:
authorPedro Alves <pedro@palves.net>2022-05-27 13:13:41 +0100
committerPedro Alves <pedro@palves.net>2022-06-17 09:55:39 +0100
commit40d97ee21fc3e39db73ee8f84b847a22f9d251cc (patch)
tree13d9f949b41d4550d1a8ba18333ed5bd4244bdfc /gdb/completer.c
parent264f98902f27497f7494933628b0f5c4e117fe59 (diff)
downloadfsf-binutils-gdb-40d97ee21fc3e39db73ee8f84b847a22f9d251cc.zip
fsf-binutils-gdb-40d97ee21fc3e39db73ee8f84b847a22f9d251cc.tar.gz
fsf-binutils-gdb-40d97ee21fc3e39db73ee8f84b847a22f9d251cc.tar.bz2
Eliminate the two-level data structures behind location_specs
Currently, there's the location_spec hierarchy, and then some location_spec subclasses have their own struct type holding all their data fields. I.e., there is this: location_spec explicit_location_spec linespec_location_spec address_location_spec probe_location_spec and then these separate types: explicit_location linespec_location where: explicit_location_spec has-a explicit_location linespec_location_spec has-a linespec_location This patch eliminates explicit_location and linespec_location, inlining their members in the corresponding location_spec type. The location_spec subclasses were the ones currently defined in location.c, so they are moved to the header. Since the definitions of the classes are now visible, we no longer need location_spec_deleter. Some constructors that are used for cloning location_specs, like: explicit explicit_location_spec (const struct explicit_location *loc) ... were converted to proper copy ctors. In the process, initialize_explicit_location is eliminated, and some functions that returned the "data type behind a locspec", like get_linespec_location are converted to downcast functions, like as_linespec_location_spec. Change-Id: Ia31ccef9382b25a52b00fa878c8df9b8cf2a6c5a
Diffstat (limited to 'gdb/completer.c')
-rw-r--r--gdb/completer.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/gdb/completer.c b/gdb/completer.c
index 2ec8d2e..b68b6de 100644
--- a/gdb/completer.c
+++ b/gdb/completer.c
@@ -712,8 +712,8 @@ collect_explicit_location_matches (completion_tracker &tracker,
const char *word,
const struct language_defn *language)
{
- const struct explicit_location *explicit_loc
- = get_explicit_location (locspec);
+ const explicit_location_spec *explicit_loc
+ = as_explicit_location_spec (locspec);
/* True if the option expects an argument. */
bool needs_arg = true;
@@ -1008,7 +1008,7 @@ location_completer (struct cmd_list_element *ignore,
text = copy;
symbol_name_match_type match_type
- = get_explicit_location (locspec.get ())->func_name_match_type;
+ = as_explicit_location_spec (locspec.get ())->func_name_match_type;
complete_address_and_linespec_locations (tracker, text, match_type);
}
}