Make symbol_set_names a member function
authorChristian Biesinger <cbiesinger@google.com>
Thu, 28 Nov 2019 02:52:35 +0000 (20:52 -0600)
committerChristian Biesinger <cbiesinger@google.com>
Fri, 27 Dec 2019 04:41:35 +0000 (01:41 -0300)
This also renames it to make it clearer that this is not a cheap
function (to compute_and_set_names).  Also renames name to m_name
to make the implementation of the renamed function more readable.

Most of the places that access sym->m_name directly were also changed
to call linkage_name () instead, to make it clearer which name they
are accessing.

gdb/ChangeLog:

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

* ada-lang.c (ada_decode_symbol): Update.
* buildsym.c (add_symbol_to_list): Update.
* coffread.c (process_coff_symbol): Update.
* ctfread.c (ctf_add_enum_member_cb): Update.
(new_symbol): Update.
(ctf_add_var_cb): Update.
* dwarf2read.c (fixup_go_packaging): Update.
(dwarf2_compute_name): Update.
(new_symbol): Update.
* jit.c (finalize_symtab): Update.
* language.c (language_alloc_type_symbol): Update.
* mdebugread.c (new_symbol): Update.
* minsyms.c (minimal_symbol_reader::record_full): Update.
(minimal_symbol_reader::install): Update.
* psymtab.c (print_partial_symbols): Update.
(psymbol_hash): Update.
(psymbol_compare): Update.
(add_psymbol_to_bcache): Update.
(maintenance_check_psymtabs): Update.
* stabsread.c (define_symbol): Update.
* symtab.c (symbol_set_names): Rename to...
(general_symbol_info::compute_and_set_names): ...this.
(general_symbol_info::natural_name): Update.
(general_symbol_info::search_name): Update.
(fixup_section): Update.
* symtab.h (struct general_symbol_info) <name>: Rename to...
<m_name>: ...this.
<compute_and_set_names>: Rename from...
(symbol_set_names): ...this.
(SYMBOL_SET_NAMES): Remove.
(struct symbol) <ctor>: Update.

Change-Id: I8da1f10cab4e0b89f19d5750fa4e6e2ac8d2b24f

14 files changed:
gdb/ChangeLog
gdb/ada-lang.c
gdb/buildsym.c
gdb/coffread.c
gdb/ctfread.c
gdb/dwarf2read.c
gdb/jit.c
gdb/language.c
gdb/mdebugread.c
gdb/minsyms.c
gdb/psymtab.c
gdb/stabsread.c
gdb/symtab.c
gdb/symtab.h

index 293ec52f9cccf86881522c87b196e5698368d3f0..8600e2ee19ecbc0de118bd75e987316dfaae6fc1 100644 (file)
@@ -1,3 +1,37 @@
+2019-12-26  Christian Biesinger  <cbiesinger@google.com>
+
+       * ada-lang.c (ada_decode_symbol): Update.
+       * buildsym.c (add_symbol_to_list): Update.
+       * coffread.c (process_coff_symbol): Update.
+       * ctfread.c (ctf_add_enum_member_cb): Update.
+       (new_symbol): Update.
+       (ctf_add_var_cb): Update.
+       * dwarf2read.c (fixup_go_packaging): Update.
+       (dwarf2_compute_name): Update.
+       (new_symbol): Update.
+       * jit.c (finalize_symtab): Update.
+       * language.c (language_alloc_type_symbol): Update.
+       * mdebugread.c (new_symbol): Update.
+       * minsyms.c (minimal_symbol_reader::record_full): Update.
+       (minimal_symbol_reader::install): Update.
+       * psymtab.c (print_partial_symbols): Update.
+       (psymbol_hash): Update.
+       (psymbol_compare): Update.
+       (add_psymbol_to_bcache): Update.
+       (maintenance_check_psymtabs): Update.
+       * stabsread.c (define_symbol): Update.
+       * symtab.c (symbol_set_names): Rename to...
+       (general_symbol_info::compute_and_set_names): ...this.
+       (general_symbol_info::natural_name): Update.
+       (general_symbol_info::search_name): Update.
+       (fixup_section): Update.
+       * symtab.h (struct general_symbol_info) <name>: Rename to...
+       <m_name>: ...this.
+       <compute_and_set_names>: Rename from...
+       (symbol_set_names): ...this.
+       (SYMBOL_SET_NAMES): Remove.
+       (struct symbol) <ctor>: Update.
+
 2019-12-26  Christian Biesinger  <cbiesinger@google.com>
 
        * NEWS: Mention that multithreaded symbol loading is now on by
index 030c4aa131b5981f9931c3506eaa4b63b0ebd7f9..b7988890fb78dcfb926eddcf1f88b05eee169099 100644 (file)
@@ -1376,7 +1376,7 @@ ada_decode_symbol (const struct general_symbol_info *arg)
 
   if (!gsymbol->ada_mangled)
     {
-      std::string decoded = ada_decode (gsymbol->name);
+      std::string decoded = ada_decode (gsymbol->linkage_name ());
       struct obstack *obstack = gsymbol->language_specific.obstack;
 
       gsymbol->ada_mangled = 1;
index 79f8305763443afc827399ee4c095e98799f3caa..df74508081794dc67d0491d47e7dfa96fc87da5e 100644 (file)
@@ -135,7 +135,7 @@ add_symbol_to_list (struct symbol *symbol, struct pending **listhead)
   struct pending *link;
 
   /* If this is an alias for another symbol, don't add it.  */
-  if (symbol->name && symbol->name[0] == '#')
+  if (symbol->linkage_name () && symbol->linkage_name ()[0] == '#')
     return;
 
   /* We keep PENDINGSIZE symbols in each link of the list.  If we
index e591651df37b59e65518a8750dae4aac69a654f3..3e5ade80a4985156e03a2bf74b3f3cb74c8c7d38 100644 (file)
@@ -1568,7 +1568,7 @@ process_coff_symbol (struct coff_symbol *cs,
   name = EXTERNAL_NAME (name, objfile->obfd);
   sym->set_language (get_current_subfile ()->language,
                     &objfile->objfile_obstack);
-  SYMBOL_SET_NAMES (sym, name, true, objfile);
+  sym->compute_and_set_names (name, true, objfile->per_bfd);
 
   /* default assumptions */
   SYMBOL_VALUE (sym) = cs->c_value;
index 65e6ebbf91b4aea44d13c44bd608c2e3345385d9..001120d9f14b0aed2648b5edb32d2d4769352892 100644 (file)
@@ -399,7 +399,7 @@ ctf_add_enum_member_cb (const char *name, int enum_value, void *arg)
       OBJSTAT (ccp->of, n_syms++);
 
       sym->set_language (language_c, &ccp->of->objfile_obstack);
-      SYMBOL_SET_NAMES (sym, name, false, ccp->of);
+      sym->compute_and_set_names (name, false, ccp->of->per_bfd);
       SYMBOL_ACLASS_INDEX (sym) = LOC_CONST;
       SYMBOL_DOMAIN (sym) = VAR_DOMAIN;
       SYMBOL_TYPE (sym) = fip->ptype;
@@ -428,7 +428,7 @@ new_symbol (struct ctf_context *ccp, struct type *type, ctf_id_t tid)
       OBJSTAT (objfile, n_syms++);
 
       sym->set_language (language_c, &objfile->objfile_obstack);
-      SYMBOL_SET_NAMES (sym, name.get (), true, objfile);
+      sym->compute_and_set_names (name.get (), true, objfile->per_bfd);
       SYMBOL_DOMAIN (sym) = VAR_DOMAIN;
       SYMBOL_ACLASS_INDEX (sym) = LOC_OPTIMIZED_OUT;
 
@@ -1048,7 +1048,7 @@ ctf_add_var_cb (const char *name, ctf_id_t id, void *arg)
        if (type)
          {
            sym = new_symbol (ccp, type, id);
-           SYMBOL_SET_NAMES (sym, name, false, ccp->of);
+           sym->compute_and_set_names (name, false, ccp->of->per_bfd);
          }
        break;
       case CTF_K_STRUCT:
@@ -1064,7 +1064,7 @@ ctf_add_var_cb (const char *name, ctf_id_t id, void *arg)
        SYMBOL_TYPE (sym) = type;
        SYMBOL_DOMAIN (sym) = VAR_DOMAIN;
        SYMBOL_ACLASS_INDEX (sym) = LOC_OPTIMIZED_OUT;
-       SYMBOL_SET_NAMES (sym, name, false, ccp->of);
+       sym->compute_and_set_names (name, false, ccp->of->per_bfd);
        add_symbol_to_list (sym, ccp->builder->get_global_symbols ());
        break;
       default:
index 2520780611db0b82b4782bc66ceadfd50df97bc7..819d37c9b8e6d3a0775791c278f63ee718e01ff4 100644 (file)
@@ -9953,7 +9953,7 @@ fixup_go_packaging (struct dwarf2_cu *cu)
 
       sym = allocate_symbol (objfile);
       sym->set_language (language_go, &objfile->objfile_obstack);
-      SYMBOL_SET_NAMES (sym, saved_package_name, false, objfile);
+      sym->compute_and_set_names (saved_package_name, false, objfile->per_bfd);
       /* 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().  */
       SYMBOL_DOMAIN (sym) = STRUCT_DOMAIN;
@@ -10878,7 +10878,7 @@ dwarf2_compute_name (const char *name,
   /* For Fortran GDB prefers DW_AT_*linkage_name for the physname if present
      but otherwise compute it by typename_concat inside GDB.
      FIXME: Actually this is not really true, or at least not always true.
-     It's all very confusing.  SYMBOL_SET_NAMES doesn't try to demangle
+     It's all very confusing.  compute_and_set_names doesn't try to demangle
      Fortran names because there is no mangling standard.  So new_symbol
      will set the demangled name to the result of dwarf2_full_name, and it is
      the demangled name that GDB uses if it exists.  */
@@ -21873,7 +21873,7 @@ new_symbol (struct die_info *die, struct type *type, struct dwarf2_cu *cu,
       /* Cache this symbol's name and the name's demangled form (if any).  */
       sym->set_language (cu->language, &objfile->objfile_obstack);
       linkagename = dwarf2_physname (name, die, cu);
-      SYMBOL_SET_NAMES (sym, linkagename, false, objfile);
+      sym->compute_and_set_names (linkagename, false, objfile->per_bfd);
 
       /* Fortran does not have mangling standard and the mangling does differ
         between gfortran, iFort etc.  */
index 0dd11e14d2f82c4732213351aaccdb8c6776716a..2cfea4561b312b8277a0537c3e6d763333d2dbaa 100644 (file)
--- a/gdb/jit.c
+++ b/gdb/jit.c
@@ -672,8 +672,8 @@ finalize_symtab (struct gdb_symtab *stab, struct objfile *objfile)
       SYMBOL_TYPE (block_name) = lookup_function_type (block_type);
       SYMBOL_BLOCK_VALUE (block_name) = new_block;
 
-      block_name->name = obstack_strdup (&objfile->objfile_obstack,
-                                        gdb_block_iter.name.get ());
+      block_name->m_name = obstack_strdup (&objfile->objfile_obstack,
+                                          gdb_block_iter.name.get ());
 
       BLOCK_FUNCTION (new_block) = block_name;
 
index ac74c7ffa3143a9e7e4be6a6cbc8318b420ac268..bf990da8a9753fac3420f6c0b0eb0ed12d8a46d7 100644 (file)
@@ -1052,7 +1052,7 @@ language_alloc_type_symbol (enum language lang, struct type *type)
   gdbarch = TYPE_OWNER (type).gdbarch;
   symbol = new (gdbarch_obstack (gdbarch)) struct symbol ();
 
-  symbol->name = TYPE_NAME (type);
+  symbol->m_name = TYPE_NAME (type);
   symbol->set_language (lang, nullptr);
   symbol->owner.arch = gdbarch;
   SYMBOL_OBJFILE_OWNED (symbol) = 0;
index 8d896d5392d50a08679bf5de039074ddb29c7b6a..314b6bd0ecd23a16216d9d4ffa939626429b6c65 100644 (file)
@@ -4762,7 +4762,7 @@ new_symbol (const char *name)
   struct symbol *s = allocate_symbol (mdebugread_objfile);
 
   s->set_language (psymtab_language, &mdebugread_objfile->objfile_obstack);
-  SYMBOL_SET_NAMES (s, name, true, mdebugread_objfile);
+  s->compute_and_set_names (name, true, mdebugread_objfile->per_bfd);
   return s;
 }
 
index 8bbffc7803aac149aa3c8da415437ae0c1088377..88606ce11a43d6cf11c7fb683753be15f4ad398f 100644 (file)
@@ -1132,10 +1132,10 @@ minimal_symbol_reader::record_full (gdb::string_view name,
                         &m_objfile->per_bfd->storage_obstack);
 
   if (copy_name)
-    msymbol->name = obstack_strndup (&m_objfile->per_bfd->storage_obstack,
-                                    name.data (), name.size ());
+    msymbol->m_name = obstack_strndup (&m_objfile->per_bfd->storage_obstack,
+                                      name.data (), name.size ());
   else
-    msymbol->name = name.data ();
+    msymbol->m_name = name.data ();
 
   SET_MSYMBOL_VALUE_ADDRESS (msymbol, address);
   MSYMBOL_SECTION (msymbol) = section;
@@ -1397,22 +1397,23 @@ minimal_symbol_reader::install ()
           for (minimal_symbol *msym = start; msym < end; ++msym)
             {
               size_t idx = msym - msymbols;
-              hash_values[idx].name_length = strlen (msym->name);
+              hash_values[idx].name_length = strlen (msym->linkage_name ());
               if (!msym->name_set)
                 {
-                  /* This will be freed later, by symbol_set_names.  */
+                  /* This will be freed later, by compute_and_set_names.  */
                   char *demangled_name
-                    = symbol_find_demangled_name (msym, msym->name);
+                    = symbol_find_demangled_name (msym, msym->linkage_name ());
                   symbol_set_demangled_name
                     (msym, demangled_name,
                      &m_objfile->per_bfd->storage_obstack);
                   msym->name_set = 1;
                 }
               /* This mangled_name_hash computation has to be outside of
-                 the name_set check, or symbol_set_names below will
+                 the name_set check, or compute_and_set_names below will
                  be called with an invalid hash value.  */
               hash_values[idx].mangled_name_hash
-                = fast_hash (msym->name, hash_values[idx].name_length);
+                = fast_hash (msym->linkage_name (),
+                             hash_values[idx].name_length);
               hash_values[idx].minsym_hash
                 = msymbol_hash (msym->linkage_name ());
               /* We only use this hash code if the search name differs
@@ -1431,10 +1432,9 @@ minimal_symbol_reader::install ()
             for (minimal_symbol *msym = start; msym < end; ++msym)
               {
                 size_t idx = msym - msymbols;
-                symbol_set_names
-                  (msym,
-                   gdb::string_view(msym->name,
-                                    hash_values[idx].name_length),
+                msym->compute_and_set_names
+                  (gdb::string_view (msym->linkage_name (),
+                                     hash_values[idx].name_length),
                    false,
                    m_objfile->per_bfd,
                    hash_values[idx].mangled_name_hash);
index ba403ae24865a0f0b303729a8a83d2f3efb09b8d..4c53e73454cdbb463bdc308d58be62aceeac0f95 100644 (file)
@@ -835,7 +835,7 @@ print_partial_symbols (struct gdbarch *gdbarch, struct objfile *objfile,
   while (count-- > 0)
     {
       QUIT;
-      fprintf_filtered (outfile, "    `%s'", (*p)->ginfo.name);
+      fprintf_filtered (outfile, "    `%s'", (*p)->ginfo.linkage_name ());
       if ((*p)->ginfo.demangled_name () != NULL)
        {
          fprintf_filtered (outfile, "  `%s'",
@@ -1534,9 +1534,9 @@ psymbol_hash (const void *addr, int length)
   h = fast_hash (&lang, sizeof (unsigned int), h);
   h = fast_hash (&domain, sizeof (unsigned int), h);
   h = fast_hash (&theclass, sizeof (unsigned int), h);
-  /* Note that psymbol names are interned via symbol_set_names, so
+  /* Note that psymbol names are interned via compute_and_set_names, so
      there's no need to hash the contents of the name here.  */
-  h = fast_hash (&psymbol->ginfo.name, sizeof (psymbol->ginfo.name), h);
+  h = fast_hash (&psymbol->ginfo.m_name, sizeof (psymbol->ginfo.m_name), h);
 
   return h;
 }
@@ -1557,9 +1557,9 @@ psymbol_compare (const void *addr1, const void *addr2, int length)
           && sym1->domain == sym2->domain
           && sym1->aclass == sym2->aclass
          /* Note that psymbol names are interned via
-            symbol_set_names, so there's no need to compare the
+            compute_and_set_names, so there's no need to compare the
             contents of the name here.  */
-          && sym1->ginfo.name == sym2->ginfo.name);
+          && sym1->ginfo.linkage_name () == sym2->ginfo.linkage_name ());
 }
 
 /* Helper function, initialises partial symbol structure and stashes
@@ -1585,8 +1585,7 @@ add_psymbol_to_bcache (gdb::string_view name, bool copy_name,
   psymbol.domain = domain;
   psymbol.aclass = theclass;
   psymbol.ginfo.set_language (language, objfile->partial_symtabs->obstack ());
-  symbol_set_names (&psymbol.ginfo, name, copy_name,
-                   objfile->per_bfd);
+  psymbol.ginfo.compute_and_set_names (name, copy_name, objfile->per_bfd);
 
   /* Stash the partial symbol away in the cache.  */
   return ((struct partial_symbol *)
@@ -2110,7 +2109,7 @@ maintenance_check_psymtabs (const char *ignore, int from_tty)
            if (!sym)
              {
                printf_filtered ("Static symbol `");
-               puts_filtered ((*psym)->ginfo.name);
+               puts_filtered ((*psym)->ginfo.linkage_name ());
                printf_filtered ("' only found in ");
                puts_filtered (ps->filename);
                printf_filtered (" psymtab\n");
@@ -2128,7 +2127,7 @@ maintenance_check_psymtabs (const char *ignore, int from_tty)
            if (!sym)
              {
                printf_filtered ("Global symbol `");
-               puts_filtered ((*psym)->ginfo.name);
+               puts_filtered ((*psym)->ginfo.linkage_name ());
                printf_filtered ("' only found in ");
                puts_filtered (ps->filename);
                printf_filtered (" psymtab\n");
index 5828ddd2c5d77f32d62ad6b3e67ced3452cf97d4..0b60402c81efc0accae32520be8aa5d9eb680828 100644 (file)
@@ -749,14 +749,10 @@ define_symbol (CORE_ADDR valu, const char *string, int desc, int type,
          new_name = cp_canonicalize_string (name);
        }
       if (!new_name.empty ())
-       {
-         SYMBOL_SET_NAMES (sym,
-                           new_name,
-                           1, objfile);
-       }
+       sym->compute_and_set_names (new_name, true, objfile->per_bfd);
       else
-       SYMBOL_SET_NAMES (sym, gdb::string_view (string, p - string), true,
-                         objfile);
+       sym->compute_and_set_names (gdb::string_view (string, p - string), true,
+                                   objfile->per_bfd);
 
       if (sym->language () == language_cplus)
        cp_scan_for_anonymous_namespaces (get_buildsym_compunit (), sym,
index 26551372cbb1d5e8ccb55ea7a77a60265cebbe82..099e92070a8a1eee6b93f0442898ce0e13045343 100644 (file)
@@ -855,19 +855,19 @@ symbol_find_demangled_name (struct general_symbol_info *gsymbol,
    so the pointer can be discarded after calling this function.  */
 
 void
-symbol_set_names (struct general_symbol_info *gsymbol,
-                 gdb::string_view linkage_name, bool copy_name,
-                 struct objfile_per_bfd_storage *per_bfd,
-                 gdb::optional<hashval_t> hash)
+general_symbol_info::compute_and_set_names (gdb::string_view linkage_name,
+                                           bool copy_name,
+                                           objfile_per_bfd_storage *per_bfd,
+                                           gdb::optional<hashval_t> hash)
 {
   struct demangled_name_entry **slot;
 
-  if (gsymbol->language () == language_ada)
+  if (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.  */
       if (!copy_name)
-       gsymbol->name = linkage_name.data ();
+       m_name = linkage_name.data ();
       else
        {
          char *name = (char *) obstack_alloc (&per_bfd->storage_obstack,
@@ -875,9 +875,9 @@ symbol_set_names (struct general_symbol_info *gsymbol,
 
          memcpy (name, linkage_name.data (), linkage_name.length ());
          name[linkage_name.length ()] = '\0';
-         gsymbol->name = name;
+         m_name = name;
        }
-      symbol_set_demangled_name (gsymbol, NULL, &per_bfd->storage_obstack);
+      symbol_set_demangled_name (this, NULL, &per_bfd->storage_obstack);
 
       return;
     }
@@ -896,7 +896,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))
+      || (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
@@ -920,9 +920,9 @@ symbol_set_names (struct general_symbol_info *gsymbol,
          allocated from the heap and needs to be freed by us, just
          like if we called symbol_find_demangled_name here.  */
       gdb::unique_xmalloc_ptr<char> demangled_name
-       (gsymbol->language_specific.demangled_name
-        ? const_cast<char *> (gsymbol->language_specific.demangled_name)
-        : symbol_find_demangled_name (gsymbol, linkage_name_copy.data ()));
+       (language_specific.demangled_name
+        ? const_cast<char *> (language_specific.demangled_name)
+        : symbol_find_demangled_name (this, linkage_name_copy.data ()));
 
       /* Suppose we have demangled_name==NULL, copy_name==0, and
         linkage_name_copy==linkage_name.  In this case, we already have the
@@ -957,18 +957,17 @@ 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 = language ();
     }
-  else if (gsymbol->language () == language_unknown
-          || gsymbol->language () == language_auto)
-    gsymbol->m_language = (*slot)->language;
+  else if (language () == language_unknown || language () == language_auto)
+    m_language = (*slot)->language;
 
-  gsymbol->name = (*slot)->mangled.data ();
+  m_name = (*slot)->mangled.data ();
   if ((*slot)->demangled != nullptr)
-    symbol_set_demangled_name (gsymbol, (*slot)->demangled.get (),
+    symbol_set_demangled_name (this, (*slot)->demangled.get (),
                               &per_bfd->storage_obstack);
   else
-    symbol_set_demangled_name (gsymbol, NULL, &per_bfd->storage_obstack);
+    symbol_set_demangled_name (this, NULL, &per_bfd->storage_obstack);
 }
 
 /* See symtab.h.  */
@@ -991,7 +990,7 @@ general_symbol_info::natural_name () const
     default:
       break;
     }
-  return name;
+  return linkage_name ();
 }
 
 /* See symtab.h.  */
@@ -1025,7 +1024,7 @@ const char *
 general_symbol_info::search_name () const
 {
   if (language () == language_ada)
-    return name;
+    return linkage_name ();
   else
     return natural_name ();
 }
@@ -1670,7 +1669,8 @@ fixup_section (struct general_symbol_info *ginfo,
      e.g. on PowerPC64, where the minimal symbol for a function will
      point to the function descriptor, while the debug symbol will
      point to the actual function code.  */
-  msym = lookup_minimal_symbol_by_pc_name (addr, ginfo->name, objfile);
+  msym = lookup_minimal_symbol_by_pc_name (addr, ginfo->linkage_name (),
+                                          objfile);
   if (msym)
     ginfo->section = MSYMBOL_SECTION (msym);
   else
index e18cd65a3539eb2d3a65812f5844bcbad14e628b..a16829693552b860fe7a4f6ef9abec4fa0c402ab 100644 (file)
@@ -389,7 +389,7 @@ struct general_symbol_info
      and linkage_name () are different.  */
 
   const char *linkage_name () const
-  { return name; }
+  { return m_name; }
 
   /* Return SYMBOL's "natural" name, i.e. the name that it was called in
      the original source code.  In languages like C++ where symbols may
@@ -419,11 +419,11 @@ struct general_symbol_info
 
   /* Set just the linkage name of a symbol; do not try to demangle
      it.  Used for constructs which do not have a mangled name,
-     e.g. struct tags.  Unlike SYMBOL_SET_NAMES, linkage_name must
+     e.g. struct tags.  Unlike compute_and_set_names, linkage_name must
      be terminated and either already on the objfile's obstack or
      permanently allocated.  */
   void set_linkage_name (const char *linkage_name)
-  { name = linkage_name; }
+  { m_name = linkage_name; }
 
   enum language language () const
   { return m_language; }
@@ -432,13 +432,21 @@ struct general_symbol_info
      depending upon the language for the symbol.  */
   void set_language (enum language language, struct obstack *obstack);
 
+  /* Set the linkage and natural names of a symbol, by demangling
+     the linkage name.  If linkage_name may not be nullterminated,
+     copy_name must be set to true.  */
+  void compute_and_set_names (gdb::string_view linkage_name, bool copy_name,
+                             struct objfile_per_bfd_storage *per_bfd,
+                             gdb::optional<hashval_t> hash
+                               = gdb::optional<hashval_t> ());
+
   /* 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
      the mangled name and demangled name, this is the mangled
      name.  */
 
-  const char *name;
+  const char *m_name;
 
   /* Value of the symbol.  Which member of this union to use, and what
      it means, depends on what kind of symbol this is and its
@@ -544,18 +552,6 @@ extern CORE_ADDR get_symbol_address (const struct symbol *sym);
 extern char *symbol_find_demangled_name (struct general_symbol_info *gsymbol,
                                         const char *mangled);
 
-/* Set the linkage and natural names of a symbol, by demangling
-   the linkage name.  If linkage_name may not be nullterminated,
-   copy_name must be set to true.  */
-#define SYMBOL_SET_NAMES(symbol,linkage_name,copy_name,objfile)        \
-  symbol_set_names ((symbol), linkage_name, copy_name, \
-                   (objfile)->per_bfd)
-extern void symbol_set_names (struct general_symbol_info *symbol,
-                             gdb::string_view linkage_name, bool copy_name,
-                             struct objfile_per_bfd_storage *per_bfd,
-                             gdb::optional<hashval_t> hash
-                               = gdb::optional<hashval_t> ());
-
 /* Return true if NAME matches the "search" name of SYMBOL, according
    to the symbol's language.  */
 #define SYMBOL_MATCHES_SEARCH_NAME(symbol, name)                       \
@@ -1092,7 +1088,7 @@ struct symbol : public general_symbol_info, public allocate_on_obstack
     {
       /* We can't use an initializer list for members of a base class, and
          general_symbol_info needs to stay a POD type.  */
-      name = nullptr;
+      m_name = nullptr;
       value.ivalue = 0;
       language_specific.obstack = nullptr;
       m_language = language_unknown;