Use an accessor function for general_symbol_info::language

Also renames the member variable to m_language to make code easier to read
when more functions become member functions.

I was originally hoping to eventually make m_language private (after a few
more patches), but unfortunately then it no longer counts as a POD type,
which means gdbsupport/poison.h won't let us use memset to initialize
this type, which psymtabs rely on to clear padding bytes so that bcache
can work properly.

gdb/ChangeLog:

2019-12-15  Christian Biesinger  <cbiesinger@google.com>

	* ada-lang.c (ada_add_block_symbols): Update.
	(ada_collect_symbol_completion_matches): Update.
	* ax-gdb.c (gen_expr): Update.
	* block.c (block_lookup_symbol): Update.
	(block_lookup_symbol_primary): Update.
	(block_find_symbol): Update.
	* cp-namespace.c (cp_lookup_symbol_imports_or_template): Update.
	* dbxread.c (process_one_symbol): Update.
	* dictionary.c (insert_symbol_hashed): Update.
	(collate_pending_symbols_by_language): Update.
	(mdict_add_symbol): Update.
	* dwarf-index-write.c (write_psymbols): Update.
	* dwarf2read.c (fixup_go_packaging): Update.
	* findvar.c (read_var_value): Update.
	* ft32-tdep.c (ft32_skip_prologue): Update.
	* go-lang.c (go_symbol_package_name): Update.
	* language.h (scoped_switch_to_sym_language_if_auto::
	scoped_switch_to_sym_language_if_auto): Update.
	* linespec.c (find_method): Update.
	(find_label_symbols_in_block): Update.
	* mdebugread.c (parse_symbol): Update.
	* mi/mi-cmd-stack.c (list_arg_or_local): Update.
	* minsyms.c (add_minsym_to_demangled_hash_table): Update.
	(minimal_symbol_reader::install): Update.
	* moxie-tdep.c (moxie_skip_prologue): Update.
	* parse.c (parse_exp_in_context): Update.
	* psymtab.c (psymbol_name_matches): Update.
	(match_partial_symbol): Update.
	(lookup_partial_symbol): Update.
	(psymbol_hash): Update.
	(psymbol_compare): Update.
	* python/py-framefilter.c (extract_sym): Update.
	(py_print_single_arg): Update.
	* stabsread.c (define_symbol): Update.
	* stack.c (print_frame_arg): Update.
	(find_frame_funname): Update.
	(info_frame_command_core): Update.
	* symfile.c (set_initial_language): Update.
	* symtab.c (symbol_set_demangled_name): Update.
	(symbol_get_demangled_name): Update.
	(symbol_set_language): Update.
	(symbol_find_demangled_name): Update.
	(symbol_set_names): Update.
	(general_symbol_info::natural_name): Update.
	(general_symbol_info::demangled_name): Update.
	(general_symbol_info::search_name): Update.
	(symbol_matches_search_name): Update.
	(eq_symbol_entry): Update.
	(iterate_over_symbols): Update.
	(completion_list_add_symbol): Update.
	(completion_list_add_msymbol): Update.
	(completion_list_add_fields): Update.
	* symtab.h (struct general_symbol_info) <language>: New function.
	<language>: Rename to...
	<m_language>: ...this.
	(SYMBOL_LANGUAGE): Remove.
	(MSYMBOL_LANGUAGE): Remove.
	(struct symbol) <ctor>: Update.
	* xstormy16-tdep.c (xstormy16_skip_prologue): Update.

Change-Id: I6464d477457e61639c63ddf8b145e407a35c235a
This commit is contained in:
Christian Biesinger 2019-12-03 17:10:32 -06:00
parent 747cfc8c6b
commit c1b5c1ebc9
27 changed files with 156 additions and 99 deletions

View file

@ -428,7 +428,7 @@ print_frame_arg (const frame_print_options &fp_opts,
annotate_arg_emitter arg_emitter;
ui_out_emit_tuple tuple_emitter (uiout, NULL);
fprintf_symbol_filtered (&stb, arg->sym->print_name (),
SYMBOL_LANGUAGE (arg->sym), DMGL_PARAMS | DMGL_ANSI);
arg->sym->language (), DMGL_PARAMS | DMGL_ANSI);
if (arg->entry_kind == print_entry_values_compact)
{
/* It is OK to provide invalid MI-like stream as with
@ -436,7 +436,7 @@ print_frame_arg (const frame_print_options &fp_opts,
stb.puts ("=");
fprintf_symbol_filtered (&stb, arg->sym->print_name (),
SYMBOL_LANGUAGE (arg->sym),
arg->sym->language (),
DMGL_PARAMS | DMGL_ANSI);
}
if (arg->entry_kind == print_entry_values_only
@ -474,7 +474,7 @@ print_frame_arg (const frame_print_options &fp_opts,
/* Use the appropriate language to display our symbol, unless the
user forced the language to a specific language. */
if (language_mode == language_mode_auto)
language = language_def (SYMBOL_LANGUAGE (arg->sym));
language = language_def (arg->sym->language ());
else
language = current_language;
@ -1261,7 +1261,7 @@ find_frame_funname (struct frame_info *frame, enum language *funlang,
{
const char *print_name = func->print_name ();
*funlang = SYMBOL_LANGUAGE (func);
*funlang = func->language ();
if (funcp)
*funcp = func;
if (*funlang == language_cplus)
@ -1291,7 +1291,7 @@ find_frame_funname (struct frame_info *frame, enum language *funlang,
if (msymbol.minsym != NULL)
{
funname.reset (xstrdup (msymbol.minsym->print_name ()));
*funlang = MSYMBOL_LANGUAGE (msymbol.minsym);
*funlang = msymbol.minsym->language ();
}
}
@ -1495,7 +1495,7 @@ info_frame_command_core (struct frame_info *fi, bool selected_frame_p)
if (func)
{
funname = func->print_name ();
funlang = SYMBOL_LANGUAGE (func);
funlang = func->language ();
if (funlang == language_cplus)
{
/* It seems appropriate to use print_name() here,
@ -1517,7 +1517,7 @@ info_frame_command_core (struct frame_info *fi, bool selected_frame_p)
if (msymbol.minsym != NULL)
{
funname = msymbol.minsym->print_name ();
funlang = MSYMBOL_LANGUAGE (msymbol.minsym);
funlang = msymbol.minsym->language ();
}
}
calling_frame_info = get_prev_frame (fi);