[10/10] Remove symbol_get_demangled_name

Message ID 20200325200715.12947-11-tom@tromey.com
State New
Headers show
Series
  • Fix two name-related bugs in DWARF reader
Related show

Commit Message

Tom Tromey March 25, 2020, 8:07 p.m.
Now that symbol_get_demangled_name is only used by general_symbol_info
methods, and because these methods already check the symbol's language
to decide what to return, symbol_get_demangled_name is no longer
needed.  This patch removes it.

gdb/ChangeLog
2020-03-25  Tom Tromey  <tom@tromey.com>

	* symtab.h (symbol_get_demangled_name): Don't declare.
	* symtab.c (symbol_get_demangled_name): Remove.
	(general_symbol_info::natural_name)
	(general_symbol_info::demangled_name): Update.
---
 gdb/ChangeLog |  7 +++++++
 gdb/symtab.c  | 21 +++------------------
 gdb/symtab.h  |  3 ---
 3 files changed, 10 insertions(+), 21 deletions(-)

-- 
2.17.2

Patch

diff --git a/gdb/symtab.c b/gdb/symtab.c
index bdbfe8e60d3..02351eb2dd0 100644
--- a/gdb/symtab.c
+++ b/gdb/symtab.c
@@ -690,21 +690,6 @@  general_symbol_info::set_demangled_name (const char *name,
     language_specific.demangled_name = name;
 }
 
-/* Return the demangled name of GSYMBOL.  */
-
-const char *
-symbol_get_demangled_name (const struct general_symbol_info *gsymbol)
-{
-  if (gsymbol->language () == language_ada)
-    {
-      if (!gsymbol->ada_mangled)
-	return NULL;
-      /* Fall through.  */
-    }
-
-  return gsymbol->language_specific.demangled_name;
-}
-
 
 /* Initialize the language dependent portion of a symbol
    depending upon the language for the symbol.  */
@@ -976,8 +961,8 @@  general_symbol_info::natural_name () const
     case language_objc:
     case language_fortran:
     case language_rust:
-      if (symbol_get_demangled_name (this) != NULL)
-	return symbol_get_demangled_name (this);
+      if (language_specific.demangled_name != nullptr)
+	return language_specific.demangled_name;
       break;
     case language_ada:
       return ada_decode_symbol (this);
@@ -1002,7 +987,7 @@  general_symbol_info::demangled_name () const
     case language_objc:
     case language_fortran:
     case language_rust:
-      dem_name = symbol_get_demangled_name (this);
+      dem_name = language_specific.demangled_name;
       break;
     case language_ada:
       dem_name = ada_decode_symbol (this);
diff --git a/gdb/symtab.h b/gdb/symtab.h
index 83938d064fe..65e1973f2b0 100644
--- a/gdb/symtab.h
+++ b/gdb/symtab.h
@@ -513,9 +513,6 @@  struct general_symbol_info
   short section;
 };
 
-extern const char *symbol_get_demangled_name
-  (const struct general_symbol_info *);
-
 extern CORE_ADDR symbol_overlayed_address (CORE_ADDR, struct obj_section *);
 
 /* Return the address of SYM.  The MAYBE_COPIED flag must be set on