gdb: Convert language la_demangle field to a method
[deliverable/binutils-gdb.git] / gdb / language.c
index 2a66f1fd6eaf8ff9c1aa4cde9a1616e2f6f46061..c447eaba0c5540a64cdf10715eb2628d687e729c 100644 (file)
@@ -589,8 +589,8 @@ char *
 language_demangle (const struct language_defn *current_language, 
                                const char *mangled, int options)
 {
-  if (current_language != NULL && current_language->la_demangle)
-    return current_language->la_demangle (mangled, options);
+  if (current_language != NULL)
+    return current_language->demangle (mangled, options);
   return NULL;
 }
 
@@ -727,15 +727,6 @@ unk_lang_printstr (struct ui_file *stream, struct type *type,
           "function unk_lang_printstr called."));
 }
 
-static void
-unk_lang_print_type (struct type *type, const char *varstring,
-                    struct ui_file *stream, int show, int level,
-                    const struct type_print_options *flags)
-{
-  error (_("internal error - unimplemented "
-          "function unk_lang_print_type called."));
-}
-
 static void
 unk_lang_value_print_inner (struct value *val,
                            struct ui_file *stream, int recurse,
@@ -758,12 +749,6 @@ static CORE_ADDR unk_lang_trampoline (struct frame_info *frame, CORE_ADDR pc)
   return 0;
 }
 
-/* Unknown languages just use the cplus demangler.  */
-static char *unk_lang_demangle (const char *mangled, int options)
-{
-  return gdb_demangle (mangled, options);
-}
-
 static char *unk_lang_class_name (const char *mangled)
 {
   return NULL;
@@ -802,7 +787,6 @@ extern const struct language_data unknown_language_data =
   unk_lang_printchar,          /* Print character constant */
   unk_lang_printstr,
   unk_lang_emit_char,
-  unk_lang_print_type,         /* Print a type using appropriate syntax */
   default_print_typedef,       /* Print a typedef using appropriate syntax */
   unk_lang_value_print_inner,  /* la_value_print_inner */
   unk_lang_value_print,                /* Print a top-level value */
@@ -810,7 +794,6 @@ extern const struct language_data unknown_language_data =
   "this",                      /* name_of_this */
   true,                                /* store_sym_names_in_linkage_form_p */
   basic_lookup_symbol_nonlocal, /* lookup_symbol_nonlocal */
-  unk_lang_demangle,           /* Language specific symbol demangler */
   unk_lang_class_name,         /* Language specific
                                   class_name_from_physname */
   unk_op_print_tab,            /* expression operators for printing */
@@ -841,6 +824,23 @@ public:
   {
     unknown_language_arch_info (gdbarch, lai);
   }
+
+  /* See language.h.  */
+
+  void print_type (struct type *type, const char *varstring,
+                  struct ui_file *stream, int show, int level,
+                  const struct type_print_options *flags) const override
+  {
+    error (_("unimplemented unknown_language::print_type called"));
+  }
+
+  /* See language.h.  */
+
+  char *demangle (const char *mangled, int options) const override
+  {
+    /* The unknown language just uses the C++ demangler.  */
+    return gdb_demangle (mangled, options);
+  }
 };
 
 /* Single instance of the unknown language class.  */
@@ -865,7 +865,6 @@ extern const struct language_data auto_language_data =
   unk_lang_printchar,          /* Print character constant */
   unk_lang_printstr,
   unk_lang_emit_char,
-  unk_lang_print_type,         /* Print a type using appropriate syntax */
   default_print_typedef,       /* Print a typedef using appropriate syntax */
   unk_lang_value_print_inner,  /* la_value_print_inner */
   unk_lang_value_print,                /* Print a top-level value */
@@ -873,7 +872,6 @@ extern const struct language_data auto_language_data =
   "this",                      /* name_of_this */
   false,                       /* store_sym_names_in_linkage_form_p */
   basic_lookup_symbol_nonlocal,        /* lookup_symbol_nonlocal */
-  unk_lang_demangle,           /* Language specific symbol demangler */
   unk_lang_class_name,         /* Language specific
                                   class_name_from_physname */
   unk_op_print_tab,            /* expression operators for printing */
@@ -904,6 +902,23 @@ public:
   {
     unknown_language_arch_info (gdbarch, lai);
   }
+
+  /* See language.h.  */
+
+  void print_type (struct type *type, const char *varstring,
+                  struct ui_file *stream, int show, int level,
+                  const struct type_print_options *flags) const override
+  {
+    error (_("unimplemented auto_language::print_type called"));
+  }
+
+  /* See language.h.  */
+
+  char *demangle (const char *mangled, int options) const override
+  {
+    /* The auto language just uses the C++ demangler.  */
+    return gdb_demangle (mangled, options);
+  }
 };
 
 /* Single instance of the fake "auto" language.  */
This page took 0.029437 seconds and 4 git commands to generate.