+2020-06-17 Andrew Burgess <andrew.burgess@embecosm.com>
+
+ * ada-lang.c (ada_collect_symbol_completion_matches): Rename to
+ ada_language::collect_symbol_completion_matches.
+ (ada_language_data): Delete la_collect_symbol_completion_matches
+ initializer.
+ (ada_language::collect_symbol_completion_matches): New member
+ function, implementation from
+ ada_collect_symbol_completion_matches.
+ * c-lang.c (c_language_data): Delete
+ la_collect_symbol_completion_matches initializer.
+ (cplus_language_data): Likewise.
+ (asm_language_data): Likewise.
+ (minimal_language_data): Likewise.
+ * d-lang.c (d_language_data): Likewise.
+ * f-lang.c (f_collect_symbol_completion_matches): Rename to
+ f_language::collect_symbol_completion_matches.
+ (f_language_data): Delete la_collect_symbol_completion_matches
+ initializer.
+ (f_language::collect_symbol_completion_matches) New member
+ function, implementation from f_collect_symbol_completion_matches.
+ * go-lang.c (go_language_data): Delete
+ la_collect_symbol_completion_matches initializer.
+ * language.c (unknown_language_data): Likewise.
+ (auto_language_data): Likewise.
+ * language.h (language_data): Delete
+ la_collect_symbol_completion_matches field.
+ (language_defn::collect_symbol_completion_matches): New member
+ function.
+ * m2-lang.c (m2_language_data): Delete
+ la_collect_symbol_completion_matches 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 (default_collect_symbol_completion_matches): Delete.
+ (collect_symbol_completion_matches): Update call to
+ collect_symbol_completion_matches.
+ (collect_symbol_completion_matches_type): Likewise.
+ * symtab.h (default_collect_symbol_completion_matches): Delete
+ declaration.
+
2020-06-17 Andrew Burgess <andrew.burgess@embecosm.com>
* ada-lang.c (ada_get_gdb_completer_word_break_characters): Delete.
return true;
}
-/* Add the list of possible symbol names completing TEXT to TRACKER.
- WORD is the entire command on which completion is made. */
-
-static void
-ada_collect_symbol_completion_matches (completion_tracker &tracker,
- complete_symbol_mode mode,
- symbol_name_match_type name_match_type,
- const char *text, const char *word,
- enum type_code code)
-{
- struct symbol *sym;
- const struct block *b, *surrounding_static_block = 0;
- struct block_iterator iter;
-
- gdb_assert (code == TYPE_CODE_UNDEF);
-
- lookup_name_info lookup_name (text, name_match_type, true);
-
- /* First, look at the partial symtab symbols. */
- expand_symtabs_matching (NULL,
- lookup_name,
- NULL,
- NULL,
- ALL_DOMAIN);
-
- /* At this point scan through the misc symbol vectors and add each
- symbol you find to the list. Eventually we want to ignore
- anything that isn't a text symbol (everything else will be
- handled by the psymtab code above). */
-
- for (objfile *objfile : current_program_space->objfiles ())
- {
- for (minimal_symbol *msymbol : objfile->msymbols ())
- {
- QUIT;
-
- if (completion_skip_symbol (mode, msymbol))
- continue;
-
- language symbol_language = msymbol->language ();
-
- /* Ada minimal symbols won't have their language set to Ada. If
- we let completion_list_add_name compare using the
- default/C-like matcher, then when completing e.g., symbols in a
- package named "pck", we'd match internal Ada symbols like
- "pckS", which are invalid in an Ada expression, unless you wrap
- them in '<' '>' to request a verbatim match.
-
- Unfortunately, some Ada encoded names successfully demangle as
- C++ symbols (using an old mangling scheme), such as "name__2Xn"
- -> "Xn::name(void)" and thus some Ada minimal symbols end up
- with the wrong language set. Paper over that issue here. */
- if (symbol_language == language_auto
- || symbol_language == language_cplus)
- symbol_language = language_ada;
-
- completion_list_add_name (tracker,
- symbol_language,
- msymbol->linkage_name (),
- lookup_name, text, word);
- }
- }
-
- /* Search upwards from currently selected frame (so that we can
- complete on local vars. */
-
- for (b = get_selected_block (0); b != NULL; b = BLOCK_SUPERBLOCK (b))
- {
- if (!BLOCK_SUPERBLOCK (b))
- surrounding_static_block = b; /* For elmin of dups */
-
- ALL_BLOCK_SYMBOLS (b, iter, sym)
- {
- if (completion_skip_symbol (mode, sym))
- continue;
-
- completion_list_add_name (tracker,
- sym->language (),
- sym->linkage_name (),
- lookup_name, text, word);
- }
- }
-
- /* Go through the symtabs and check the externs and statics for
- symbols which match. */
-
- for (objfile *objfile : current_program_space->objfiles ())
- {
- for (compunit_symtab *s : objfile->compunits ())
- {
- QUIT;
- b = BLOCKVECTOR_BLOCK (COMPUNIT_BLOCKVECTOR (s), GLOBAL_BLOCK);
- ALL_BLOCK_SYMBOLS (b, iter, sym)
- {
- if (completion_skip_symbol (mode, sym))
- continue;
-
- completion_list_add_name (tracker,
- sym->language (),
- sym->linkage_name (),
- lookup_name, text, word);
- }
- }
- }
-
- for (objfile *objfile : current_program_space->objfiles ())
- {
- for (compunit_symtab *s : objfile->compunits ())
- {
- QUIT;
- b = BLOCKVECTOR_BLOCK (COMPUNIT_BLOCKVECTOR (s), STATIC_BLOCK);
- /* Don't do this block twice. */
- if (b == surrounding_static_block)
- continue;
- ALL_BLOCK_SYMBOLS (b, iter, sym)
- {
- if (completion_skip_symbol (mode, sym))
- continue;
-
- completion_list_add_name (tracker,
- sym->language (),
- sym->linkage_name (),
- lookup_name, text, word);
- }
- }
- }
-}
-
/* Field Access */
/* Return non-zero if TYPE is a pointer to the GNAT dispatch table used
ada_op_print_tab, /* expression operators for printing */
0, /* c-style arrays */
1, /* String lower bound */
- ada_collect_symbol_completion_matches,
ada_watch_location_expression,
&ada_varobj_ops,
ada_is_string_type,
return ada_completer_word_break_characters;
}
+ /* See language.h. */
+
+ void collect_symbol_completion_matches (completion_tracker &tracker,
+ complete_symbol_mode mode,
+ symbol_name_match_type name_match_type,
+ const char *text, const char *word,
+ enum type_code code) const override
+ {
+ struct symbol *sym;
+ const struct block *b, *surrounding_static_block = 0;
+ struct block_iterator iter;
+
+ gdb_assert (code == TYPE_CODE_UNDEF);
+
+ lookup_name_info lookup_name (text, name_match_type, true);
+
+ /* First, look at the partial symtab symbols. */
+ expand_symtabs_matching (NULL,
+ lookup_name,
+ NULL,
+ NULL,
+ ALL_DOMAIN);
+
+ /* At this point scan through the misc symbol vectors and add each
+ symbol you find to the list. Eventually we want to ignore
+ anything that isn't a text symbol (everything else will be
+ handled by the psymtab code above). */
+
+ for (objfile *objfile : current_program_space->objfiles ())
+ {
+ for (minimal_symbol *msymbol : objfile->msymbols ())
+ {
+ QUIT;
+
+ if (completion_skip_symbol (mode, msymbol))
+ continue;
+
+ language symbol_language = msymbol->language ();
+
+ /* Ada minimal symbols won't have their language set to Ada. If
+ we let completion_list_add_name compare using the
+ default/C-like matcher, then when completing e.g., symbols in a
+ package named "pck", we'd match internal Ada symbols like
+ "pckS", which are invalid in an Ada expression, unless you wrap
+ them in '<' '>' to request a verbatim match.
+
+ Unfortunately, some Ada encoded names successfully demangle as
+ C++ symbols (using an old mangling scheme), such as "name__2Xn"
+ -> "Xn::name(void)" and thus some Ada minimal symbols end up
+ with the wrong language set. Paper over that issue here. */
+ if (symbol_language == language_auto
+ || symbol_language == language_cplus)
+ symbol_language = language_ada;
+
+ completion_list_add_name (tracker,
+ symbol_language,
+ msymbol->linkage_name (),
+ lookup_name, text, word);
+ }
+ }
+
+ /* Search upwards from currently selected frame (so that we can
+ complete on local vars. */
+
+ for (b = get_selected_block (0); b != NULL; b = BLOCK_SUPERBLOCK (b))
+ {
+ if (!BLOCK_SUPERBLOCK (b))
+ surrounding_static_block = b; /* For elmin of dups */
+
+ ALL_BLOCK_SYMBOLS (b, iter, sym)
+ {
+ if (completion_skip_symbol (mode, sym))
+ continue;
+
+ completion_list_add_name (tracker,
+ sym->language (),
+ sym->linkage_name (),
+ lookup_name, text, word);
+ }
+ }
+
+ /* Go through the symtabs and check the externs and statics for
+ symbols which match. */
+
+ for (objfile *objfile : current_program_space->objfiles ())
+ {
+ for (compunit_symtab *s : objfile->compunits ())
+ {
+ QUIT;
+ b = BLOCKVECTOR_BLOCK (COMPUNIT_BLOCKVECTOR (s), GLOBAL_BLOCK);
+ ALL_BLOCK_SYMBOLS (b, iter, sym)
+ {
+ if (completion_skip_symbol (mode, sym))
+ continue;
+
+ completion_list_add_name (tracker,
+ sym->language (),
+ sym->linkage_name (),
+ lookup_name, text, word);
+ }
+ }
+ }
+
+ for (objfile *objfile : current_program_space->objfiles ())
+ {
+ for (compunit_symtab *s : objfile->compunits ())
+ {
+ QUIT;
+ b = BLOCKVECTOR_BLOCK (COMPUNIT_BLOCKVECTOR (s), STATIC_BLOCK);
+ /* Don't do this block twice. */
+ if (b == surrounding_static_block)
+ continue;
+ ALL_BLOCK_SYMBOLS (b, iter, sym)
+ {
+ if (completion_skip_symbol (mode, sym))
+ continue;
+
+ completion_list_add_name (tracker,
+ sym->language (),
+ sym->linkage_name (),
+ lookup_name, text, word);
+ }
+ }
+ }
+ }
+
protected:
/* See language.h. */
c_op_print_tab, /* expression operators for printing */
1, /* c-style arrays */
0, /* String lower bound */
- default_collect_symbol_completion_matches,
c_watch_location_expression,
&c_varobj_ops,
c_is_string_type_p,
c_op_print_tab, /* expression operators for printing */
1, /* c-style arrays */
0, /* String lower bound */
- default_collect_symbol_completion_matches,
c_watch_location_expression,
&cplus_varobj_ops,
c_is_string_type_p,
c_op_print_tab, /* expression operators for printing */
1, /* c-style arrays */
0, /* String lower bound */
- default_collect_symbol_completion_matches,
c_watch_location_expression,
&default_varobj_ops,
c_is_string_type_p,
c_op_print_tab, /* expression operators for printing */
1, /* c-style arrays */
0, /* String lower bound */
- default_collect_symbol_completion_matches,
c_watch_location_expression,
&default_varobj_ops,
c_is_string_type_p,
d_op_print_tab, /* Expression operators for printing. */
1, /* C-style arrays. */
0, /* String lower bound. */
- default_collect_symbol_completion_matches,
c_watch_location_expression,
&default_varobj_ops,
c_is_string_type_p,
nr_f_primitive_types
};
-/* Consider the modules separator :: as a valid symbol name character
- class. */
-
-static void
-f_collect_symbol_completion_matches (completion_tracker &tracker,
- complete_symbol_mode mode,
- symbol_name_match_type compare_name,
- const char *text, const char *word,
- enum type_code code)
-{
- default_collect_symbol_completion_matches_break_on (tracker, mode,
- compare_name,
- text, word, ":", code);
-}
-
/* Special expression evaluation cases for Fortran. */
static struct value *
f_op_print_tab, /* expression operators for printing */
0, /* arrays are first-class (not c-style) */
1, /* String lower bound */
- f_collect_symbol_completion_matches,
c_watch_location_expression,
&default_varobj_ops,
f_is_string_type_p,
return retval;
}
+
+ /* See language.h. */
+
+ void collect_symbol_completion_matches (completion_tracker &tracker,
+ complete_symbol_mode mode,
+ symbol_name_match_type name_match_type,
+ const char *text, const char *word,
+ enum type_code code) const override
+ {
+ /* Consider the modules separator :: as a valid symbol name character
+ class. */
+ default_collect_symbol_completion_matches_break_on (tracker, mode,
+ name_match_type,
+ text, word, ":",
+ code);
+ }
+
protected:
/* See language.h. */
go_op_print_tab, /* Expression operators for printing. */
1, /* C-style arrays. */
0, /* String lower bound. */
- default_collect_symbol_completion_matches,
c_watch_location_expression,
&default_varobj_ops,
go_is_string_type_p,
unk_op_print_tab, /* expression operators for printing */
1, /* c-style arrays */
0, /* String lower bound */
- default_collect_symbol_completion_matches,
c_watch_location_expression,
&default_varobj_ops,
default_is_string_type_p,
unk_op_print_tab, /* expression operators for printing */
1, /* c-style arrays */
0, /* String lower bound */
- default_collect_symbol_completion_matches,
c_watch_location_expression,
&default_varobj_ops,
default_is_string_type_p,
/* Index to use for extracting the first element of a string. */
char string_lower_bound;
- /* Add to the completion tracker all symbols which are possible
- completions for TEXT. WORD is the entire command on which the
- completion is being made. If CODE is TYPE_CODE_UNDEF, then all
- symbols should be examined; otherwise, only STRUCT_DOMAIN
- symbols whose type has a code of CODE should be matched. */
- void (*la_collect_symbol_completion_matches)
- (completion_tracker &tracker,
- complete_symbol_mode mode,
- symbol_name_match_type match_type,
- const char *text,
- const char *word,
- enum type_code code);
-
/* Return an expression that can be used for a location
watchpoint. TYPE is a pointer type that points to the memory
to watch, and ADDR is the address of the watched memory. */
return default_word_break_characters ();
}
+ /* Add to the completion tracker all symbols which are possible
+ completions for TEXT. WORD is the entire command on which the
+ completion is being made. If CODE is TYPE_CODE_UNDEF, then all
+ symbols should be examined; otherwise, only STRUCT_DOMAIN symbols
+ whose type has a code of CODE should be matched. */
+
+ virtual void collect_symbol_completion_matches
+ (completion_tracker &tracker,
+ complete_symbol_mode mode,
+ symbol_name_match_type name_match_type,
+ const char *text,
+ const char *word,
+ enum type_code code) const
+ {
+ return default_collect_symbol_completion_matches_break_on
+ (tracker, mode, name_match_type, text, word, "", code);
+ }
+
/* List of all known languages. */
static const struct language_defn *languages[nr_languages];
m2_op_print_tab, /* expression operators for printing */
0, /* arrays are first-class (not c-style) */
0, /* String lower bound */
- default_collect_symbol_completion_matches,
c_watch_location_expression,
&default_varobj_ops,
m2_is_string_type_p,
objc_op_print_tab, /* Expression operators for printing */
1, /* C-style arrays */
0, /* String lower bound */
- default_collect_symbol_completion_matches,
c_watch_location_expression,
&default_varobj_ops,
c_is_string_type_p,
c_op_print_tab, /* expression operators for printing */
1, /* c-style arrays */
0, /* String lower bound */
- default_collect_symbol_completion_matches,
c_watch_location_expression,
&default_varobj_ops,
c_is_string_type_p,
pascal_op_print_tab, /* expression operators for printing */
1, /* c-style arrays */
0, /* String lower bound */
- default_collect_symbol_completion_matches,
c_watch_location_expression,
&default_varobj_ops,
pascal_is_string_type_p,
c_op_print_tab, /* expression operators for printing */
1, /* c-style arrays */
0, /* String lower bound */
- default_collect_symbol_completion_matches,
rust_watch_location_expression,
&default_varobj_ops,
rust_is_string_type_p,
}
}
-void
-default_collect_symbol_completion_matches (completion_tracker &tracker,
- complete_symbol_mode mode,
- symbol_name_match_type name_match_type,
- const char *text, const char *word,
- enum type_code code)
-{
- return default_collect_symbol_completion_matches_break_on (tracker, mode,
- name_match_type,
- text, word, "",
- code);
-}
-
/* Collect all symbols (regardless of class) which begin by matching
TEXT. */
symbol_name_match_type name_match_type,
const char *text, const char *word)
{
- current_language->la_collect_symbol_completion_matches (tracker, mode,
- name_match_type,
- text, word,
- TYPE_CODE_UNDEF);
+ current_language->collect_symbol_completion_matches (tracker, mode,
+ name_match_type,
+ text, word,
+ TYPE_CODE_UNDEF);
}
/* Like collect_symbol_completion_matches, but only collect
gdb_assert (code == TYPE_CODE_UNION
|| code == TYPE_CODE_STRUCT
|| code == TYPE_CODE_ENUM);
- current_language->la_collect_symbol_completion_matches (tracker, mode,
- name_match_type,
- text, word, code);
+ current_language->collect_symbol_completion_matches (tracker, mode,
+ name_match_type,
+ text, word, code);
}
/* Like collect_symbol_completion_matches, but collects a list of
symbol_name_match_type name_match_type,
const char *text, const char *word, const char *break_on,
enum type_code code);
-extern void default_collect_symbol_completion_matches
- (completion_tracker &tracker,
- complete_symbol_mode,
- symbol_name_match_type name_match_type,
- const char *,
- const char *,
- enum type_code);
extern void collect_symbol_completion_matches
(completion_tracker &tracker,
complete_symbol_mode mode,