diff options
author | Christian Biesinger <cbiesinger@google.com> | 2019-12-03 17:10:32 -0600 |
---|---|---|
committer | Christian Biesinger <cbiesinger@google.com> | 2019-12-16 00:44:36 -0600 |
commit | c1b5c1ebc938b6dc0277363b8c47d75b0b5a621f (patch) | |
tree | cd54633651ff68399debc38f92e762b15b607aa2 /gdb/symtab.c | |
parent | 747cfc8c6bb23d40b3fa987f6c3df9d3a0d7b817 (diff) | |
download | gdb-c1b5c1ebc938b6dc0277363b8c47d75b0b5a621f.zip gdb-c1b5c1ebc938b6dc0277363b8c47d75b0b5a621f.tar.gz gdb-c1b5c1ebc938b6dc0277363b8c47d75b0b5a621f.tar.bz2 |
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
Diffstat (limited to 'gdb/symtab.c')
-rw-r--r-- | gdb/symtab.c | 60 |
1 files changed, 29 insertions, 31 deletions
diff --git a/gdb/symtab.c b/gdb/symtab.c index 6fd1c8c..a082ee2 100644 --- a/gdb/symtab.c +++ b/gdb/symtab.c @@ -675,7 +675,7 @@ symbol_set_demangled_name (struct general_symbol_info *gsymbol, const char *name, struct obstack *obstack) { - if (gsymbol->language == language_ada) + if (gsymbol->language () == language_ada) { if (name == NULL) { @@ -697,7 +697,7 @@ symbol_set_demangled_name (struct general_symbol_info *gsymbol, const char * symbol_get_demangled_name (const struct general_symbol_info *gsymbol) { - if (gsymbol->language == language_ada) + if (gsymbol->language () == language_ada) { if (!gsymbol->ada_mangled) return NULL; @@ -716,16 +716,16 @@ symbol_set_language (struct general_symbol_info *gsymbol, enum language language, struct obstack *obstack) { - gsymbol->language = language; - if (gsymbol->language == language_cplus - || gsymbol->language == language_d - || gsymbol->language == language_go - || gsymbol->language == language_objc - || gsymbol->language == language_fortran) + gsymbol->m_language = language; + if (language == language_cplus + || language == language_d + || language == language_go + || language == language_objc + || language == language_fortran) { symbol_set_demangled_name (gsymbol, NULL, obstack); } - else if (gsymbol->language == language_ada) + else if (language == language_ada) { gdb_assert (gsymbol->ada_mangled == 0); gsymbol->language_specific.obstack = obstack; @@ -819,12 +819,12 @@ symbol_find_demangled_name (struct general_symbol_info *gsymbol, char *demangled = NULL; int i; - if (gsymbol->language == language_unknown) - gsymbol->language = language_auto; + if (gsymbol->language () == language_unknown) + gsymbol->m_language = language_auto; - if (gsymbol->language != language_auto) + if (gsymbol->language () != language_auto) { - const struct language_defn *lang = language_def (gsymbol->language); + const struct language_defn *lang = language_def (gsymbol->language ()); language_sniff_from_mangled_name (lang, mangled, &demangled); return demangled; @@ -837,7 +837,7 @@ symbol_find_demangled_name (struct general_symbol_info *gsymbol, if (language_sniff_from_mangled_name (lang, mangled, &demangled)) { - gsymbol->language = l; + gsymbol->m_language = l; return demangled; } } @@ -864,7 +864,7 @@ symbol_set_names (struct general_symbol_info *gsymbol, { struct demangled_name_entry **slot; - if (gsymbol->language == language_ada) + if (gsymbol->language () == language_ada) { /* In Ada, we do the symbol lookups using the mangled name, so we can save some space by not storing the demangled name. */ @@ -898,7 +898,7 @@ symbol_set_names (struct general_symbol_info *gsymbol, if (*slot == NULL /* A C version of the symbol may have already snuck into the table. This happens to, e.g., main.init (__go_init_main). Cope. */ - || (gsymbol->language == language_go && (*slot)->demangled == nullptr)) + || (gsymbol->language () == language_go && (*slot)->demangled == nullptr)) { /* A 0-terminated copy of the linkage name. Callers must set COPY_NAME to true if the string might not be nullterminated. We have to make @@ -959,11 +959,11 @@ symbol_set_names (struct general_symbol_info *gsymbol, (gdb::string_view (mangled_ptr, linkage_name.length ())); } (*slot)->demangled = std::move (demangled_name); - (*slot)->language = gsymbol->language; + (*slot)->language = gsymbol->language (); } - else if (gsymbol->language == language_unknown - || gsymbol->language == language_auto) - gsymbol->language = (*slot)->language; + else if (gsymbol->language () == language_unknown + || gsymbol->language () == language_auto) + gsymbol->m_language = (*slot)->language; gsymbol->name = (*slot)->mangled.data (); if ((*slot)->demangled != nullptr) @@ -978,7 +978,7 @@ symbol_set_names (struct general_symbol_info *gsymbol, const char * general_symbol_info::natural_name () const { - switch (language) + switch (language ()) { case language_cplus: case language_d: @@ -1003,7 +1003,7 @@ general_symbol_info::demangled_name () const { const char *dem_name = NULL; - switch (language) + switch (language ()) { case language_cplus: case language_d: @@ -1026,7 +1026,7 @@ general_symbol_info::demangled_name () const const char * general_symbol_info::search_name () const { - if (language == language_ada) + if (language () == language_ada) return name; else return natural_name (); @@ -1039,7 +1039,7 @@ symbol_matches_search_name (const struct general_symbol_info *gsymbol, const lookup_name_info &name) { symbol_name_matcher_ftype *name_match - = get_symbol_name_matcher (language_def (gsymbol->language), name); + = get_symbol_name_matcher (language_def (gsymbol->language ()), name); return name_match (gsymbol->search_name (), name, NULL); } @@ -1219,8 +1219,7 @@ eq_symbol_entry (const struct symbol_cache_slot *slot, if (!SYMBOL_MATCHES_SEARCH_NAME (sym, lookup_name)) return 0; - if (!symbol_matches_domain (SYMBOL_LANGUAGE (sym), - slot_domain, domain)) + if (!symbol_matches_domain (sym->language (), slot_domain, domain)) return 0; } } @@ -2846,8 +2845,7 @@ iterate_over_symbols (const struct block *block, ALL_BLOCK_SYMBOLS_WITH_NAME (block, name, iter, sym) { - if (symbol_matches_domain (SYMBOL_LANGUAGE (sym), - SYMBOL_DOMAIN (sym), domain)) + if (symbol_matches_domain (sym->language (), SYMBOL_DOMAIN (sym), domain)) { struct block_symbol block_sym = {sym, block}; @@ -5262,7 +5260,7 @@ completion_list_add_symbol (completion_tracker &tracker, const lookup_name_info &lookup_name, const char *text, const char *word) { - completion_list_add_name (tracker, SYMBOL_LANGUAGE (sym), + completion_list_add_name (tracker, sym->language (), sym->natural_name (), lookup_name, text, word); } @@ -5275,7 +5273,7 @@ completion_list_add_msymbol (completion_tracker &tracker, const lookup_name_info &lookup_name, const char *text, const char *word) { - completion_list_add_name (tracker, MSYMBOL_LANGUAGE (sym), + completion_list_add_name (tracker, sym->language (), sym->natural_name (), lookup_name, text, word); } @@ -5409,7 +5407,7 @@ completion_list_add_fields (completion_tracker &tracker, if (c == TYPE_CODE_UNION || c == TYPE_CODE_STRUCT) for (j = TYPE_N_BASECLASSES (t); j < TYPE_NFIELDS (t); j++) if (TYPE_FIELD_NAME (t, j)) - completion_list_add_name (tracker, SYMBOL_LANGUAGE (sym), + completion_list_add_name (tracker, sym->language (), TYPE_FIELD_NAME (t, j), lookup_name, text, word); } |