* [PATCH 3/3] Use a member function to set a symbol's language
2019-12-14 23:30 [PATCH 0/3] Replace symbols' LANGUAGE macros with member functions cbiesinger
@ 2019-12-14 23:30 ` cbiesinger
2019-12-14 23:30 ` [PATCH 1/3] Use symbol_set_language " cbiesinger
` (2 subsequent siblings)
3 siblings, 0 replies; 6+ messages in thread
From: cbiesinger @ 2019-12-14 23:30 UTC (permalink / raw)
To: gdb-patches; +Cc: Christian Biesinger
From: Christian Biesinger <cbiesinger@google.com>
This removes symbol_set_language and SYMBOL_SET_LANGUAGE in favor of
a new function general_symbol_info::set_language. symbol and minimal_symbol
already inherit from that struct so this works naturally.
gdb/ChangeLog:
2019-12-14 Christian Biesinger <cbiesinger@google.com>
* ada-exp.y (write_ambiguous_var): Update.
* coffread.c (process_coff_symbol): Update.
* ctfread.c (ctf_add_enum_member_cb): Update.
(new_symbol): Update.
* dwarf2read.c (fixup_go_packaging): Update.
(new_symbol): Update.
* language.c (language_alloc_type_symbol): Update.
* mdebugread.c (new_symbol): Update.
* minsyms.c (minimal_symbol_reader::record_full): Update.
* psymtab.c (add_psymbol_to_bcache): Update.
* stabsread.c (define_symbol): Update.
(read_enum_type): Update.
* symtab.c (symbol_set_language): Make this a member function...
(general_symbol_info::set_language): ... here.
* symtab.h (struct general_symbol_info) <set_language>: New function.
(SYMBOL_SET_LANGUAGE): Remove.
(symbol_set_language): Remove.
Change-Id: Ideafb6c384004b9adef793a1192735c501da41d5
---
gdb/ada-exp.y | 2 +-
gdb/coffread.c | 4 ++--
gdb/ctfread.c | 4 ++--
gdb/dwarf2read.c | 4 ++--
gdb/language.c | 2 +-
gdb/mdebugread.c | 3 +--
gdb/minsyms.c | 4 ++--
gdb/psymtab.c | 3 +--
gdb/stabsread.c | 8 ++++----
gdb/symtab.c | 16 +++++++---------
gdb/symtab.h | 12 ++++--------
11 files changed, 27 insertions(+), 35 deletions(-)
diff --git a/gdb/ada-exp.y b/gdb/ada-exp.y
index 6b1bdfa139..a02e22dafa 100644
--- a/gdb/ada-exp.y
+++ b/gdb/ada-exp.y
@@ -1106,7 +1106,7 @@ write_ambiguous_var (struct parser_state *par_state,
SYMBOL_DOMAIN (sym) = UNDEF_DOMAIN;
sym->set_linkage_name (obstack_strndup (&temp_parse_space, name, len));
- symbol_set_language (sym, language_ada, nullptr);
+ sym->set_language (language_ada, nullptr);
write_exp_elt_opcode (par_state, OP_VAR_VALUE);
write_exp_elt_block (par_state, block);
diff --git a/gdb/coffread.c b/gdb/coffread.c
index d0a9233de7..e591651df3 100644
--- a/gdb/coffread.c
+++ b/gdb/coffread.c
@@ -1566,8 +1566,8 @@ process_coff_symbol (struct coff_symbol *cs,
name = cs->c_name;
name = EXTERNAL_NAME (name, objfile->obfd);
- SYMBOL_SET_LANGUAGE (sym, get_current_subfile ()->language,
- &objfile->objfile_obstack);
+ sym->set_language (get_current_subfile ()->language,
+ &objfile->objfile_obstack);
SYMBOL_SET_NAMES (sym, name, true, objfile);
/* default assumptions */
diff --git a/gdb/ctfread.c b/gdb/ctfread.c
index c5f9130c6a..06a4bc2f1b 100644
--- a/gdb/ctfread.c
+++ b/gdb/ctfread.c
@@ -379,7 +379,7 @@ ctf_add_enum_member_cb (const char *name, int enum_value, void *arg)
struct symbol *sym = allocate_symbol (ccp->of);
OBJSTAT (ccp->of, n_syms++);
- SYMBOL_SET_LANGUAGE (sym, language_c, &ccp->of->objfile_obstack);
+ sym->set_language (language_c, &ccp->of->objfile_obstack);
SYMBOL_SET_NAMES (sym, name, false, ccp->of);
SYMBOL_ACLASS_INDEX (sym) = LOC_CONST;
SYMBOL_DOMAIN (sym) = VAR_DOMAIN;
@@ -408,7 +408,7 @@ new_symbol (ctf_context_t *ccp, struct type *type, ctf_id_t tid)
sym = allocate_symbol (objfile);
OBJSTAT (objfile, n_syms++);
- SYMBOL_SET_LANGUAGE (sym, language_c, &objfile->objfile_obstack);
+ sym->set_language (language_c, &objfile->objfile_obstack);
SYMBOL_SET_NAMES (sym, name.get (), true, objfile);
SYMBOL_DOMAIN (sym) = VAR_DOMAIN;
SYMBOL_ACLASS_INDEX (sym) = LOC_OPTIMIZED_OUT;
diff --git a/gdb/dwarf2read.c b/gdb/dwarf2read.c
index 6a09d5568b..ecfae68427 100644
--- a/gdb/dwarf2read.c
+++ b/gdb/dwarf2read.c
@@ -9952,7 +9952,7 @@ fixup_go_packaging (struct dwarf2_cu *cu)
struct symbol *sym;
sym = allocate_symbol (objfile);
- SYMBOL_SET_LANGUAGE (sym, language_go, &objfile->objfile_obstack);
+ sym->set_language (language_go, &objfile->objfile_obstack);
SYMBOL_SET_NAMES (sym, saved_package_name, false, objfile);
/* This is not VAR_DOMAIN because we want a way to ensure a lookup of,
e.g., "main" finds the "main" module and not C's main(). */
@@ -21782,7 +21782,7 @@ new_symbol (struct die_info *die, struct type *type, struct dwarf2_cu *cu,
OBJSTAT (objfile, n_syms++);
/* Cache this symbol's name and the name's demangled form (if any). */
- SYMBOL_SET_LANGUAGE (sym, cu->language, &objfile->objfile_obstack);
+ sym->set_language (cu->language, &objfile->objfile_obstack);
linkagename = dwarf2_physname (name, die, cu);
SYMBOL_SET_NAMES (sym, linkagename, false, objfile);
diff --git a/gdb/language.c b/gdb/language.c
index ed850350b1..76efc49737 100644
--- a/gdb/language.c
+++ b/gdb/language.c
@@ -1051,7 +1051,7 @@ language_alloc_type_symbol (enum language lang, struct type *type)
symbol = new (gdbarch_obstack (gdbarch)) struct symbol ();
symbol->name = TYPE_NAME (type);
- symbol_set_language (symbol, lang, nullptr);
+ symbol->set_language (lang, nullptr);
symbol->owner.arch = gdbarch;
SYMBOL_OBJFILE_OWNED (symbol) = 0;
SYMBOL_TYPE (symbol) = type;
diff --git a/gdb/mdebugread.c b/gdb/mdebugread.c
index ceffc012c1..8d896d5392 100644
--- a/gdb/mdebugread.c
+++ b/gdb/mdebugread.c
@@ -4761,8 +4761,7 @@ new_symbol (const char *name)
{
struct symbol *s = allocate_symbol (mdebugread_objfile);
- SYMBOL_SET_LANGUAGE (s, psymtab_language,
- &mdebugread_objfile->objfile_obstack);
+ s->set_language (psymtab_language, &mdebugread_objfile->objfile_obstack);
SYMBOL_SET_NAMES (s, name, true, mdebugread_objfile);
return s;
}
diff --git a/gdb/minsyms.c b/gdb/minsyms.c
index 6afa393633..8bbffc7803 100644
--- a/gdb/minsyms.c
+++ b/gdb/minsyms.c
@@ -1128,8 +1128,8 @@ minimal_symbol_reader::record_full (gdb::string_view name,
m_msym_bunch = newobj;
}
msymbol = &m_msym_bunch->contents[m_msym_bunch_index];
- symbol_set_language (msymbol, language_auto,
- &m_objfile->per_bfd->storage_obstack);
+ msymbol->set_language (language_auto,
+ &m_objfile->per_bfd->storage_obstack);
if (copy_name)
msymbol->name = obstack_strndup (&m_objfile->per_bfd->storage_obstack,
diff --git a/gdb/psymtab.c b/gdb/psymtab.c
index 28b452b07f..ba403ae248 100644
--- a/gdb/psymtab.c
+++ b/gdb/psymtab.c
@@ -1584,8 +1584,7 @@ add_psymbol_to_bcache (gdb::string_view name, bool copy_name,
psymbol.ginfo.section = section;
psymbol.domain = domain;
psymbol.aclass = theclass;
- symbol_set_language (&psymbol.ginfo, language,
- objfile->partial_symtabs->obstack ());
+ psymbol.ginfo.set_language (language, objfile->partial_symtabs->obstack ());
symbol_set_names (&psymbol.ginfo, name, copy_name,
objfile->per_bfd);
diff --git a/gdb/stabsread.c b/gdb/stabsread.c
index 1b5426e284..5828ddd2c5 100644
--- a/gdb/stabsread.c
+++ b/gdb/stabsread.c
@@ -700,8 +700,8 @@ define_symbol (CORE_ADDR valu, const char *string, int desc, int type,
SYMBOL_LINE (sym) = 0; /* unknown */
}
- SYMBOL_SET_LANGUAGE (sym, get_current_subfile ()->language,
- &objfile->objfile_obstack);
+ sym->set_language (get_current_subfile ()->language,
+ &objfile->objfile_obstack);
if (is_cplus_marker (string[0]))
{
@@ -3638,8 +3638,8 @@ read_enum_type (const char **pp, struct type *type,
sym = allocate_symbol (objfile);
sym->set_linkage_name (name);
- SYMBOL_SET_LANGUAGE (sym, get_current_subfile ()->language,
- &objfile->objfile_obstack);
+ sym->set_language (get_current_subfile ()->language,
+ &objfile->objfile_obstack);
SYMBOL_ACLASS_INDEX (sym) = LOC_CONST;
SYMBOL_DOMAIN (sym) = VAR_DOMAIN;
SYMBOL_VALUE (sym) = n;
diff --git a/gdb/symtab.c b/gdb/symtab.c
index a082ee21a9..26551372cb 100644
--- a/gdb/symtab.c
+++ b/gdb/symtab.c
@@ -712,28 +712,26 @@ symbol_get_demangled_name (const struct general_symbol_info *gsymbol)
depending upon the language for the symbol. */
void
-symbol_set_language (struct general_symbol_info *gsymbol,
- enum language language,
- struct obstack *obstack)
+general_symbol_info::set_language (enum language language,
+ struct obstack *obstack)
{
- gsymbol->m_language = language;
+ 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);
+ symbol_set_demangled_name (this, NULL, obstack);
}
else if (language == language_ada)
{
- gdb_assert (gsymbol->ada_mangled == 0);
- gsymbol->language_specific.obstack = obstack;
+ gdb_assert (ada_mangled == 0);
+ language_specific.obstack = obstack;
}
else
{
- memset (&gsymbol->language_specific, 0,
- sizeof (gsymbol->language_specific));
+ memset (&language_specific, 0, sizeof (language_specific));
}
}
diff --git a/gdb/symtab.h b/gdb/symtab.h
index 09e2a20a36..e18cd65a35 100644
--- a/gdb/symtab.h
+++ b/gdb/symtab.h
@@ -428,6 +428,10 @@ struct general_symbol_info
enum language language () const
{ return m_language; }
+ /* Initializes the language dependent portion of a symbol
+ depending upon the language for the symbol. */
+ void set_language (enum language language, struct obstack *obstack);
+
/* Name of the symbol. This is a required field. Storage for the
name is allocated on the objfile_obstack for the associated
objfile. For languages like C++ that make a distinction between
@@ -531,14 +535,6 @@ extern CORE_ADDR get_symbol_address (const struct symbol *sym);
? (&(((objfile)->sections)[(symbol)->section])) \
: NULL)
-/* Initializes the language dependent portion of a symbol
- depending upon the language for the symbol. */
-#define SYMBOL_SET_LANGUAGE(symbol,language,obstack) \
- (symbol_set_language ((symbol), (language), (obstack)))
-extern void symbol_set_language (struct general_symbol_info *symbol,
- enum language language,
- struct obstack *obstack);
-
/* Try to determine the demangled name for a symbol, based on the
language of that symbol. If the language is set to language_auto,
it will attempt to find any demangling algorithm that works and
--
2.24.1.735.g03f4e72817-goog
^ permalink raw reply [flat|nested] 6+ messages in thread
* [PATCH 2/3] Use an accessor function for general_symbol_info::language
2019-12-14 23:30 [PATCH 0/3] Replace symbols' LANGUAGE macros with member functions cbiesinger
2019-12-14 23:30 ` [PATCH 3/3] Use a member function to set a symbol's language cbiesinger
2019-12-14 23:30 ` [PATCH 1/3] Use symbol_set_language " cbiesinger
@ 2019-12-14 23:30 ` cbiesinger
2019-12-15 2:38 ` [PATCH 0/3] Replace symbols' LANGUAGE macros with member functions Simon Marchi
3 siblings, 0 replies; 6+ messages in thread
From: cbiesinger @ 2019-12-14 23:30 UTC (permalink / raw)
To: gdb-patches; +Cc: Christian Biesinger
From: Christian Biesinger <cbiesinger@google.com>
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-14 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.c (language_alloc_type_symbol): 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
---
gdb/ada-lang.c | 13 ++++----
gdb/ax-gdb.c | 2 +-
gdb/block.c | 10 +++----
gdb/cp-namespace.c | 2 +-
gdb/dbxread.c | 4 +--
gdb/dictionary.c | 10 +++----
gdb/dwarf-index-write.c | 4 +--
gdb/dwarf2read.c | 2 +-
gdb/findvar.c | 2 +-
gdb/ft32-tdep.c | 2 +-
gdb/go-lang.c | 2 +-
gdb/language.c | 2 +-
gdb/language.h | 2 +-
gdb/linespec.c | 6 ++--
gdb/mdebugread.c | 4 +--
gdb/mi/mi-cmd-stack.c | 2 +-
gdb/minsyms.c | 5 ++--
gdb/moxie-tdep.c | 2 +-
gdb/parse.c | 2 +-
gdb/psymtab.c | 16 +++++-----
gdb/python/py-framefilter.c | 8 ++---
gdb/stabsread.c | 6 ++--
gdb/stack.c | 14 ++++-----
gdb/symfile.c | 2 +-
gdb/symtab.c | 60 ++++++++++++++++++-------------------
gdb/symtab.h | 9 +++---
gdb/xstormy16-tdep.c | 2 +-
27 files changed, 95 insertions(+), 100 deletions(-)
diff --git a/gdb/ada-lang.c b/gdb/ada-lang.c
index 3289a8e5c8..030c4aa131 100644
--- a/gdb/ada-lang.c
+++ b/gdb/ada-lang.c
@@ -6220,8 +6220,7 @@ ada_add_block_symbols (struct obstack *obstackp,
sym != NULL;
sym = block_iter_match_next (lookup_name, &iter))
{
- if (symbol_matches_domain (SYMBOL_LANGUAGE (sym),
- SYMBOL_DOMAIN (sym), domain))
+ if (symbol_matches_domain (sym->language (), SYMBOL_DOMAIN (sym), domain))
{
if (SYMBOL_CLASS (sym) != LOC_UNRESOLVED)
{
@@ -6260,7 +6259,7 @@ ada_add_block_symbols (struct obstack *obstackp,
ALL_BLOCK_SYMBOLS (block, iter, sym)
{
- if (symbol_matches_domain (SYMBOL_LANGUAGE (sym),
+ if (symbol_matches_domain (sym->language (),
SYMBOL_DOMAIN (sym), domain))
{
int cmp;
@@ -6428,7 +6427,7 @@ ada_collect_symbol_completion_matches (completion_tracker &tracker,
if (completion_skip_symbol (mode, msymbol))
continue;
- language symbol_language = MSYMBOL_LANGUAGE (msymbol);
+ 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
@@ -6466,7 +6465,7 @@ ada_collect_symbol_completion_matches (completion_tracker &tracker,
continue;
completion_list_add_name (tracker,
- SYMBOL_LANGUAGE (sym),
+ sym->language (),
sym->linkage_name (),
lookup_name, text, word);
}
@@ -6487,7 +6486,7 @@ ada_collect_symbol_completion_matches (completion_tracker &tracker,
continue;
completion_list_add_name (tracker,
- SYMBOL_LANGUAGE (sym),
+ sym->language (),
sym->linkage_name (),
lookup_name, text, word);
}
@@ -6509,7 +6508,7 @@ ada_collect_symbol_completion_matches (completion_tracker &tracker,
continue;
completion_list_add_name (tracker,
- SYMBOL_LANGUAGE (sym),
+ sym->language (),
sym->linkage_name (),
lookup_name, text, word);
}
diff --git a/gdb/ax-gdb.c b/gdb/ax-gdb.c
index 8489587064..d25413ea1f 100644
--- a/gdb/ax-gdb.c
+++ b/gdb/ax-gdb.c
@@ -2230,7 +2230,7 @@ gen_expr (struct expression *exp, union exp_element **pc,
b = block_for_pc (ax->scope);
func = block_linkage_function (b);
- lang = language_def (SYMBOL_LANGUAGE (func));
+ lang = language_def (func->language ());
sym = lookup_language_this (lang, b).symbol;
if (!sym)
diff --git a/gdb/block.c b/gdb/block.c
index b49c548adc..58441bfe89 100644
--- a/gdb/block.c
+++ b/gdb/block.c
@@ -729,7 +729,7 @@ block_lookup_symbol (const struct block *block, const char *name,
STRUCT vs VAR domain symbols. So if a matching symbol is found,
make sure there is no "better" matching symbol, i.e., one with
exactly the same domain. PR 16253. */
- if (symbol_matches_domain (SYMBOL_LANGUAGE (sym),
+ if (symbol_matches_domain (sym->language (),
SYMBOL_DOMAIN (sym), domain))
other = better_symbol (other, sym, domain);
}
@@ -750,7 +750,7 @@ block_lookup_symbol (const struct block *block, const char *name,
ALL_BLOCK_SYMBOLS_WITH_NAME (block, lookup_name, iter, sym)
{
- if (symbol_matches_domain (SYMBOL_LANGUAGE (sym),
+ if (symbol_matches_domain (sym->language (),
SYMBOL_DOMAIN (sym), domain))
{
sym_found = sym;
@@ -819,8 +819,7 @@ block_lookup_symbol_primary (const struct block *block, const char *name,
STRUCT vs VAR domain symbols. So if a matching symbol is found,
make sure there is no "better" matching symbol, i.e., one with
exactly the same domain. PR 16253. */
- if (symbol_matches_domain (SYMBOL_LANGUAGE (sym),
- SYMBOL_DOMAIN (sym), domain))
+ if (symbol_matches_domain (sym->language (), SYMBOL_DOMAIN (sym), domain))
other = better_symbol (other, sym, domain);
}
@@ -847,8 +846,7 @@ block_find_symbol (const struct block *block, const char *name,
{
/* MATCHER is deliberately called second here so that it never sees
a non-domain-matching symbol. */
- if (symbol_matches_domain (SYMBOL_LANGUAGE (sym),
- SYMBOL_DOMAIN (sym), domain)
+ if (symbol_matches_domain (sym->language (), SYMBOL_DOMAIN (sym), domain)
&& matcher (sym, data))
return sym;
}
diff --git a/gdb/cp-namespace.c b/gdb/cp-namespace.c
index d813d05073..20067cdd03 100644
--- a/gdb/cp-namespace.c
+++ b/gdb/cp-namespace.c
@@ -516,7 +516,7 @@ cp_lookup_symbol_imports_or_template (const char *scope,
domain_name (domain));
}
- if (function != NULL && SYMBOL_LANGUAGE (function) == language_cplus)
+ if (function != NULL && function->language () == language_cplus)
{
/* Search the function's template parameters. */
if (SYMBOL_IS_CPLUS_TEMPLATE_FUNCTION (function))
diff --git a/gdb/dbxread.c b/gdb/dbxread.c
index 73f1ba8759..ecfa89ae0c 100644
--- a/gdb/dbxread.c
+++ b/gdb/dbxread.c
@@ -2456,7 +2456,7 @@ process_one_symbol (int type, int desc, CORE_ADDR valu, const char *name,
cstk.start_addr, cstk.start_addr + valu);
/* For C++, set the block's scope. */
- if (SYMBOL_LANGUAGE (cstk.name) == language_cplus)
+ if (cstk.name->language () == language_cplus)
cp_set_block_scope (cstk.name, block, &objfile->objfile_obstack);
/* May be switching to an assembler file which may not be using
@@ -2823,7 +2823,7 @@ process_one_symbol (int type, int desc, CORE_ADDR valu, const char *name,
cstk.start_addr, valu);
/* For C++, set the block's scope. */
- if (SYMBOL_LANGUAGE (cstk.name) == language_cplus)
+ if (cstk.name->language () == language_cplus)
cp_set_block_scope (cstk.name, block,
&objfile->objfile_obstack);
}
diff --git a/gdb/dictionary.c b/gdb/dictionary.c
index 0d13370b72..125a062d80 100644
--- a/gdb/dictionary.c
+++ b/gdb/dictionary.c
@@ -640,9 +640,9 @@ insert_symbol_hashed (struct dictionary *dict,
/* We don't want to insert a symbol into a dictionary of a different
language. The two may not use the same hashing algorithm. */
- gdb_assert (SYMBOL_LANGUAGE (sym) == DICT_LANGUAGE (dict)->la_language);
+ gdb_assert (sym->language () == DICT_LANGUAGE (dict)->la_language);
- hash = search_name_hash (SYMBOL_LANGUAGE (sym), sym->search_name ());
+ hash = search_name_hash (sym->language (), sym->search_name ());
hash_index = hash % DICT_HASHED_NBUCKETS (dict);
sym->hash_next = buckets[hash_index];
buckets[hash_index] = sym;
@@ -928,7 +928,7 @@ collate_pending_symbols_by_language (const struct pending *symbol_list)
{
for (int i = list_counter->nsyms - 1; i >= 0; --i)
{
- enum language language = SYMBOL_LANGUAGE (list_counter->symbol[i]);
+ enum language language = list_counter->symbol[i]->language ();
nsyms[language].push_back (list_counter->symbol[i]);
}
}
@@ -1116,13 +1116,13 @@ void
mdict_add_symbol (struct multidictionary *mdict, struct symbol *sym)
{
struct dictionary *dict
- = find_language_dictionary (mdict, SYMBOL_LANGUAGE (sym));
+ = find_language_dictionary (mdict, sym->language ());
if (dict == nullptr)
{
/* SYM is of a new language that we haven't previously seen.
Create a new dictionary for it. */
- dict = create_new_language_dictionary (mdict, SYMBOL_LANGUAGE (sym));
+ dict = create_new_language_dictionary (mdict, sym->language ());
}
dict_add_symbol (dict, sym);
diff --git a/gdb/dwarf-index-write.c b/gdb/dwarf-index-write.c
index cbad308430..66c2368b9c 100644
--- a/gdb/dwarf-index-write.c
+++ b/gdb/dwarf-index-write.c
@@ -543,7 +543,7 @@ write_psymbols (struct mapped_symtab *symtab,
{
struct partial_symbol *psym = *psymp;
- if (psym->ginfo.language == language_ada)
+ if (psym->ginfo.language () == language_ada)
error (_("Ada is not currently supported by the index; "
"use the DWARF 5 index instead"));
@@ -690,7 +690,7 @@ public:
return;
const char *name = psym->ginfo.search_name ();
- if (psym->ginfo.language == language_ada)
+ if (psym->ginfo.language () == language_ada)
{
/* We want to ensure that the Ada main function's name appears
verbatim in the index. However, this name will be of the
diff --git a/gdb/dwarf2read.c b/gdb/dwarf2read.c
index e009b523cc..6a09d5568b 100644
--- a/gdb/dwarf2read.c
+++ b/gdb/dwarf2read.c
@@ -9916,7 +9916,7 @@ fixup_go_packaging (struct dwarf2_cu *cu)
{
struct symbol *sym = list->symbol[i];
- if (SYMBOL_LANGUAGE (sym) == language_go
+ if (sym->language () == language_go
&& SYMBOL_CLASS (sym) == LOC_BLOCK)
{
char *this_package_name = go_symbol_package_name (sym);
diff --git a/gdb/findvar.c b/gdb/findvar.c
index 50e99f48d1..18dd3cd04f 100644
--- a/gdb/findvar.c
+++ b/gdb/findvar.c
@@ -807,7 +807,7 @@ struct value *
read_var_value (struct symbol *var, const struct block *var_block,
struct frame_info *frame)
{
- const struct language_defn *lang = language_def (SYMBOL_LANGUAGE (var));
+ const struct language_defn *lang = language_def (var->language ());
gdb_assert (lang != NULL);
gdb_assert (lang->la_read_var_value != NULL);
diff --git a/gdb/ft32-tdep.c b/gdb/ft32-tdep.c
index bded02fae4..56c2165037 100644
--- a/gdb/ft32-tdep.c
+++ b/gdb/ft32-tdep.c
@@ -299,7 +299,7 @@ ft32_skip_prologue (struct gdbarch *gdbarch, CORE_ADDR pc)
/* Found a function. */
sym = lookup_symbol (func_name, NULL, VAR_DOMAIN, NULL).symbol;
/* Don't use line number debug info for assembly source files. */
- if ((sym != NULL) && SYMBOL_LANGUAGE (sym) != language_asm)
+ if ((sym != NULL) && sym->language () != language_asm)
{
sal = find_pc_line (func_addr, 0);
if (sal.end && sal.end < func_end)
diff --git a/gdb/go-lang.c b/gdb/go-lang.c
index bf2eb1b6f7..b527d9f72e 100644
--- a/gdb/go-lang.c
+++ b/gdb/go-lang.c
@@ -420,7 +420,7 @@ go_symbol_package_name (const struct symbol *sym)
char *name_buf;
char *result;
- gdb_assert (SYMBOL_LANGUAGE (sym) == language_go);
+ gdb_assert (sym->language () == language_go);
name_buf = unpack_mangled_go_symbol (mangled_name,
&package_name, &object_name,
&method_type_package_name,
diff --git a/gdb/language.c b/gdb/language.c
index da6f7a860a..ed850350b1 100644
--- a/gdb/language.c
+++ b/gdb/language.c
@@ -1051,7 +1051,7 @@ language_alloc_type_symbol (enum language lang, struct type *type)
symbol = new (gdbarch_obstack (gdbarch)) struct symbol ();
symbol->name = TYPE_NAME (type);
- symbol->set_language (language, lang, nullptr);
+ symbol_set_language (symbol, lang, nullptr);
symbol->owner.arch = gdbarch;
SYMBOL_OBJFILE_OWNED (symbol) = 0;
SYMBOL_TYPE (symbol) = type;
diff --git a/gdb/language.h b/gdb/language.h
index 5fc25a235f..14d6fac303 100644
--- a/gdb/language.h
+++ b/gdb/language.h
@@ -715,7 +715,7 @@ public:
{
m_lang = current_language->la_language;
m_switched = true;
- set_language (SYMBOL_LANGUAGE (sym));
+ set_language (sym->language ());
}
else
{
diff --git a/gdb/linespec.c b/gdb/linespec.c
index 61dcb4830e..9c17331a93 100644
--- a/gdb/linespec.c
+++ b/gdb/linespec.c
@@ -3683,7 +3683,7 @@ find_method (struct linespec_state *self, std::vector<symtab *> *file_symtabs,
gdb_assert (!pspace->executing_startup);
set_current_program_space (pspace);
t = check_typedef (SYMBOL_TYPE (sym));
- find_methods (t, SYMBOL_LANGUAGE (sym),
+ find_methods (t, sym->language (),
method_name, &result_names, &superclass_vec);
/* Handle all items from a single program space at once; and be
@@ -3696,7 +3696,7 @@ find_method (struct linespec_state *self, std::vector<symtab *> *file_symtabs,
this program space, consider superclasses. */
if (result_names.size () == last_result_len)
find_superclass_methods (std::move (superclass_vec), method_name,
- SYMBOL_LANGUAGE (sym), &result_names);
+ sym->language (), &result_names);
/* We have a list of candidate symbol names, so now we
iterate over the symbol tables looking for all
@@ -3998,7 +3998,7 @@ find_label_symbols_in_block (const struct block *block,
ALL_BLOCK_SYMBOLS (block, iter, sym)
{
- if (symbol_matches_domain (SYMBOL_LANGUAGE (sym),
+ if (symbol_matches_domain (sym->language (),
SYMBOL_DOMAIN (sym), LABEL_DOMAIN)
&& cmp (sym->search_name (), name, name_len) == 0)
{
diff --git a/gdb/mdebugread.c b/gdb/mdebugread.c
index f279f13171..ceffc012c1 100644
--- a/gdb/mdebugread.c
+++ b/gdb/mdebugread.c
@@ -794,11 +794,11 @@ parse_symbol (SYMR *sh, union aux_ext *ax, char *ext_sh, int bigend,
/* All functions in C++ have prototypes. For C we don't have enough
information in the debug info. */
- if (SYMBOL_LANGUAGE (s) == language_cplus)
+ if (s->language () == language_cplus)
TYPE_PROTOTYPED (SYMBOL_TYPE (s)) = 1;
/* Create and enter a new lexical context. */
- b = new_block (FUNCTION_BLOCK, SYMBOL_LANGUAGE (s));
+ b = new_block (FUNCTION_BLOCK, s->language ());
SYMBOL_BLOCK_VALUE (s) = b;
BLOCK_FUNCTION (b) = s;
BLOCK_START (b) = BLOCK_END (b) = sh->value;
diff --git a/gdb/mi/mi-cmd-stack.c b/gdb/mi/mi-cmd-stack.c
index 50843313f8..6cd255d072 100644
--- a/gdb/mi/mi-cmd-stack.c
+++ b/gdb/mi/mi-cmd-stack.c
@@ -543,7 +543,7 @@ list_arg_or_local (const struct frame_arg *arg, enum what_to_list what,
get_no_prettyformat_print_options (&opts);
opts.deref_ref = 1;
common_val_print (arg->val, &stb, 0, &opts,
- language_def (SYMBOL_LANGUAGE (arg->sym)));
+ language_def (arg->sym->language ()));
}
catch (const gdb_exception_error &except)
{
diff --git a/gdb/minsyms.c b/gdb/minsyms.c
index 40bedbd3e7..6afa393633 100644
--- a/gdb/minsyms.c
+++ b/gdb/minsyms.c
@@ -162,7 +162,7 @@ add_minsym_to_demangled_hash_table (struct minimal_symbol *sym,
{
if (sym->demangled_hash_next == NULL)
{
- objfile->per_bfd->demangled_hash_languages.set (MSYMBOL_LANGUAGE (sym));
+ objfile->per_bfd->demangled_hash_languages.set (sym->language ());
struct minimal_symbol **table
= objfile->per_bfd->msymbol_demangled_hash;
@@ -1420,8 +1420,7 @@ minimal_symbol_reader::install ()
build_minimal_symbol_hash_tables. */
if (msym->search_name () != msym->linkage_name ())
hash_values[idx].minsym_demangled_hash
- = search_name_hash (MSYMBOL_LANGUAGE (msym),
- msym->search_name ());
+ = search_name_hash (msym->language (), msym->search_name ());
}
{
/* To limit how long we hold the lock, we only acquire it here
diff --git a/gdb/moxie-tdep.c b/gdb/moxie-tdep.c
index 81fdb7111c..0c38438697 100644
--- a/gdb/moxie-tdep.c
+++ b/gdb/moxie-tdep.c
@@ -232,7 +232,7 @@ moxie_skip_prologue (struct gdbarch *gdbarch, CORE_ADDR pc)
sym = lookup_symbol (func_name, NULL, VAR_DOMAIN, NULL).symbol;
/* Don't use line number debug info for assembly source
files. */
- if (sym && SYMBOL_LANGUAGE (sym) != language_asm)
+ if (sym && sym->language () != language_asm)
{
sal = find_pc_line (func_addr, 0);
if (sal.end && sal.end < func_end)
diff --git a/gdb/parse.c b/gdb/parse.c
index d7360aa6bb..399f776a71 100644
--- a/gdb/parse.c
+++ b/gdb/parse.c
@@ -1098,7 +1098,7 @@ parse_exp_in_context (const char **stringptr, CORE_ADDR pc,
struct symbol *func = block_linkage_function (block);
if (func != NULL)
- lang = language_def (SYMBOL_LANGUAGE (func));
+ lang = language_def (func->language ());
if (lang == NULL || lang->la_language == language_unknown)
lang = current_language;
}
diff --git a/gdb/psymtab.c b/gdb/psymtab.c
index 2cbc6d4f65..28b452b07f 100644
--- a/gdb/psymtab.c
+++ b/gdb/psymtab.c
@@ -531,7 +531,7 @@ static bool
psymbol_name_matches (partial_symbol *psym,
const lookup_name_info &lookup_name)
{
- const language_defn *lang = language_def (psym->ginfo.language);
+ const language_defn *lang = language_def (psym->ginfo.language ());
symbol_name_matcher_ftype *name_match
= get_symbol_name_matcher (lang, lookup_name);
return name_match (psym->ginfo.search_name (), lookup_name, NULL);
@@ -581,7 +581,7 @@ match_partial_symbol (struct objfile *objfile,
center = bottom + (top - bottom) / 2;
gdb_assert (center < top);
- enum language lang = (*center)->ginfo.language;
+ enum language lang = (*center)->ginfo.language ();
const char *lang_ln
= name.language_lookup_name (lang).c_str ();
@@ -596,7 +596,7 @@ match_partial_symbol (struct objfile *objfile,
while (top <= real_top
&& psymbol_name_matches (*top, name))
{
- if (symbol_matches_domain ((*top)->ginfo.language,
+ if (symbol_matches_domain ((*top)->ginfo.language (),
(*top)->domain, domain))
return *top;
top++;
@@ -610,7 +610,7 @@ match_partial_symbol (struct objfile *objfile,
{
for (psym = start; psym < start + length; psym++)
{
- if (symbol_matches_domain ((*psym)->ginfo.language,
+ if (symbol_matches_domain ((*psym)->ginfo.language (),
(*psym)->domain, domain)
&& psymbol_name_matches (*psym, name))
return *psym;
@@ -719,7 +719,7 @@ lookup_partial_symbol (struct objfile *objfile,
while (top <= real_top && symbol_matches_search_name (&(*top)->ginfo,
lookup_name))
{
- if (symbol_matches_domain ((*top)->ginfo.language,
+ if (symbol_matches_domain ((*top)->ginfo.language (),
(*top)->domain, domain))
return *top;
top++;
@@ -733,7 +733,7 @@ lookup_partial_symbol (struct objfile *objfile,
{
for (psym = start; psym < start + length; psym++)
{
- if (symbol_matches_domain ((*psym)->ginfo.language,
+ if (symbol_matches_domain ((*psym)->ginfo.language (),
(*psym)->domain, domain)
&& symbol_matches_search_name (&(*psym)->ginfo, lookup_name))
return *psym;
@@ -1526,7 +1526,7 @@ psymbol_hash (const void *addr, int length)
{
unsigned long h = 0;
struct partial_symbol *psymbol = (struct partial_symbol *) addr;
- unsigned int lang = psymbol->ginfo.language;
+ unsigned int lang = psymbol->ginfo.language ();
unsigned int domain = psymbol->domain;
unsigned int theclass = psymbol->aclass;
@@ -1553,7 +1553,7 @@ psymbol_compare (const void *addr1, const void *addr2, int length)
return (memcmp (&sym1->ginfo.value, &sym2->ginfo.value,
sizeof (sym1->ginfo.value)) == 0
- && sym1->ginfo.language == sym2->ginfo.language
+ && sym1->ginfo.language () == sym2->ginfo.language ()
&& sym1->domain == sym2->domain
&& sym1->aclass == sym2->aclass
/* Note that psymbol names are interned via
diff --git a/gdb/python/py-framefilter.c b/gdb/python/py-framefilter.c
index 8e38d8d7a4..fd03d313e9 100644
--- a/gdb/python/py-framefilter.c
+++ b/gdb/python/py-framefilter.c
@@ -109,7 +109,7 @@ extract_sym (PyObject *obj, gdb::unique_xmalloc_ptr<char> *name,
from the symbol. If mode is not "auto", then the language
has been explicitly set, use that. */
if (language_mode == language_mode_auto)
- *language = language_def (SYMBOL_LANGUAGE (*sym));
+ *language = language_def ((*sym)->language ());
else
*language = current_language;
}
@@ -320,7 +320,7 @@ py_print_single_arg (struct ui_out *out,
{
if (fa->val == NULL && fa->error == NULL)
return;
- language = language_def (SYMBOL_LANGUAGE (fa->sym));
+ language = language_def (fa->sym->language ());
val = fa->val;
}
else
@@ -349,14 +349,14 @@ py_print_single_arg (struct ui_out *out,
string_file stb;
fprintf_symbol_filtered (&stb, fa->sym->print_name (),
- SYMBOL_LANGUAGE (fa->sym),
+ fa->sym->language (),
DMGL_PARAMS | DMGL_ANSI);
if (fa->entry_kind == print_entry_values_compact)
{
stb.puts ("=");
fprintf_symbol_filtered (&stb, fa->sym->print_name (),
- SYMBOL_LANGUAGE (fa->sym),
+ fa->sym->language (),
DMGL_PARAMS | DMGL_ANSI);
}
if (fa->entry_kind == print_entry_values_only
diff --git a/gdb/stabsread.c b/gdb/stabsread.c
index 91a73dd10d..1b5426e284 100644
--- a/gdb/stabsread.c
+++ b/gdb/stabsread.c
@@ -740,7 +740,7 @@ define_symbol (CORE_ADDR valu, const char *string, int desc, int type,
normal:
std::string new_name;
- if (SYMBOL_LANGUAGE (sym) == language_cplus)
+ if (sym->language () == language_cplus)
{
char *name = (char *) alloca (p - string + 1);
@@ -758,7 +758,7 @@ define_symbol (CORE_ADDR valu, const char *string, int desc, int type,
SYMBOL_SET_NAMES (sym, gdb::string_view (string, p - string), true,
objfile);
- if (SYMBOL_LANGUAGE (sym) == language_cplus)
+ if (sym->language () == language_cplus)
cp_scan_for_anonymous_namespaces (get_buildsym_compunit (), sym,
objfile);
@@ -1225,7 +1225,7 @@ define_symbol (CORE_ADDR valu, const char *string, int desc, int type,
This is important to do, because of forward references:
The cleanup of undefined types stored in undef_types only uses
STRUCT_DOMAIN symbols to perform the replacement. */
- synonym = (SYMBOL_LANGUAGE (sym) == language_ada && p[-2] != 'T');
+ synonym = (sym->language () == language_ada && p[-2] != 'T');
/* Typedef */
SYMBOL_TYPE (sym) = read_type (&p, objfile);
diff --git a/gdb/stack.c b/gdb/stack.c
index cc7b7e5bbe..2282052487 100644
--- a/gdb/stack.c
+++ b/gdb/stack.c
@@ -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);
diff --git a/gdb/symfile.c b/gdb/symfile.c
index 8852e2893a..5ca89b45b3 100644
--- a/gdb/symfile.c
+++ b/gdb/symfile.c
@@ -1697,7 +1697,7 @@ set_initial_language (void)
struct symbol *sym = lookup_symbol (name, NULL, VAR_DOMAIN, NULL).symbol;
if (sym != NULL)
- lang = SYMBOL_LANGUAGE (sym);
+ lang = sym->language ();
}
if (lang == language_unknown)
diff --git a/gdb/symtab.c b/gdb/symtab.c
index 6fd1c8c4bc..a082ee21a9 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);
}
diff --git a/gdb/symtab.h b/gdb/symtab.h
index e8321d4bb8..09e2a20a36 100644
--- a/gdb/symtab.h
+++ b/gdb/symtab.h
@@ -425,6 +425,9 @@ struct general_symbol_info
void set_linkage_name (const char *linkage_name)
{ name = linkage_name; }
+ enum language language () const
+ { return m_language; }
+
/* Name of the symbol. This is a required field. Storage for the
name is allocated on the objfile_obstack for the associated
objfile. For languages like C++ that make a distinction between
@@ -479,7 +482,7 @@ struct general_symbol_info
This is used to select one of the fields from the language specific
union above. */
- ENUM_BITFIELD(language) language : LANGUAGE_BITS;
+ ENUM_BITFIELD(language) m_language : LANGUAGE_BITS;
/* This is only used by Ada. If set, then the 'demangled_name' field
of language_specific is valid. Otherwise, the 'obstack' field is
@@ -522,7 +525,6 @@ extern CORE_ADDR get_symbol_address (const struct symbol *sym);
#define SYMBOL_VALUE_COMMON_BLOCK(symbol) (symbol)->value.common_block
#define SYMBOL_BLOCK_VALUE(symbol) (symbol)->value.block
#define SYMBOL_VALUE_CHAIN(symbol) (symbol)->value.chain
-#define SYMBOL_LANGUAGE(symbol) (symbol)->language
#define SYMBOL_SECTION(symbol) (symbol)->section
#define SYMBOL_OBJ_SECTION(objfile, symbol) \
(((symbol)->section >= 0) \
@@ -741,7 +743,6 @@ extern CORE_ADDR get_msymbol_address (struct objfile *objf,
#define MSYMBOL_VALUE_BYTES(symbol) (symbol)->value.bytes
#define MSYMBOL_BLOCK_VALUE(symbol) (symbol)->value.block
#define MSYMBOL_VALUE_CHAIN(symbol) (symbol)->value.chain
-#define MSYMBOL_LANGUAGE(symbol) (symbol)->language
#define MSYMBOL_SECTION(symbol) (symbol)->section
#define MSYMBOL_OBJ_SECTION(objfile, symbol) \
(((symbol)->section >= 0) \
@@ -1098,7 +1099,7 @@ struct symbol : public general_symbol_info, public allocate_on_obstack
name = nullptr;
value.ivalue = 0;
language_specific.obstack = nullptr;
- language = language_unknown;
+ m_language = language_unknown;
ada_mangled = 0;
section = 0;
/* GCC 4.8.5 (on CentOS 7) does not correctly compile class-
diff --git a/gdb/xstormy16-tdep.c b/gdb/xstormy16-tdep.c
index 9b8b7e2864..52a6f3e2aa 100644
--- a/gdb/xstormy16-tdep.c
+++ b/gdb/xstormy16-tdep.c
@@ -430,7 +430,7 @@ xstormy16_skip_prologue (struct gdbarch *gdbarch, CORE_ADDR pc)
/* Found a function. */
sym = lookup_symbol (func_name, NULL, VAR_DOMAIN, NULL).symbol;
/* Don't use line number debug info for assembly source files. */
- if (sym && SYMBOL_LANGUAGE (sym) != language_asm)
+ if (sym && sym->language () != language_asm)
{
sal = find_pc_line (func_addr, 0);
if (sal.end && sal.end < func_end)
--
2.24.1.735.g03f4e72817-goog
^ permalink raw reply [flat|nested] 6+ messages in thread