gdb: Convert language la_is_string_type_p field to a method
[deliverable/binutils-gdb.git] / gdb / language.c
index 9867ac4b4b58b8d97575c3171f353f8502180ae3..c993cfc57a6e1d0e96e74be555ea5d8c41111670 100644 (file)
@@ -681,6 +681,23 @@ language_defn::printstr (struct ui_file *stream, struct type *elttype,
              options);
 }
 
+/* See language.h.  */
+
+void
+language_defn::print_typedef (struct type *type, struct symbol *new_symbol,
+                             struct ui_file *stream) const
+{
+  c_print_typedef (type, new_symbol, stream);
+}
+
+/* See language.h.  */
+
+bool
+language_defn::is_string_type_p (struct type *type) const
+{
+  return c_is_string_type_p (type);
+}
+
 /* The default implementation of the get_symbol_name_matcher_inner method
    from the language_defn class.  Matches with strncmp_iw.  */
 
@@ -732,9 +749,10 @@ language_defn::get_symbol_name_matcher_inner
   return default_symbol_name_matcher;
 }
 
-/* See language.h.  */
+/* Return true if TYPE is a string type, otherwise return false.  This
+   default implementation only detects TYPE_CODE_STRING.  */
 
-bool
+static bool
 default_is_string_type_p (struct type *type)
 {
   type = check_typedef (type);
@@ -774,14 +792,12 @@ extern const struct language_data unknown_language_data =
   macro_expansion_no,
   NULL,
   &exp_descriptor_standard,
-  default_print_typedef,       /* Print a typedef using appropriate syntax */
   "this",                      /* name_of_this */
   true,                                /* store_sym_names_in_linkage_form_p */
   unk_op_print_tab,            /* expression operators for printing */
   1,                           /* c-style arrays */
   0,                           /* String lower bound */
   &default_varobj_ops,
-  default_is_string_type_p,
   "{...}"                      /* la_struct_too_deep_ellipsis */
 };
 
@@ -868,6 +884,21 @@ public:
   {
     error (_("unimplemented unknown_language::printstr called"));
   }
+
+  /* See language.h.  */
+
+  void print_typedef (struct type *type, struct symbol *new_symbol,
+                     struct ui_file *stream) const override
+  {
+    error (_("unimplemented unknown_language::print_typedef called"));
+  }
+
+  /* See language.h.  */
+
+  bool is_string_type_p (struct type *type) const override
+  {
+    return default_is_string_type_p (type);
+  }
 };
 
 /* Single instance of the unknown language class.  */
@@ -887,14 +918,12 @@ extern const struct language_data auto_language_data =
   macro_expansion_no,
   NULL,
   &exp_descriptor_standard,
-  default_print_typedef,       /* Print a typedef using appropriate syntax */
   "this",                      /* name_of_this */
   false,                       /* store_sym_names_in_linkage_form_p */
   unk_op_print_tab,            /* expression operators for printing */
   1,                           /* c-style arrays */
   0,                           /* String lower bound */
   &default_varobj_ops,
-  default_is_string_type_p,
   "{...}"                      /* la_struct_too_deep_ellipsis */
 };
 
@@ -981,6 +1010,21 @@ public:
   {
     error (_("unimplemented auto_language::printstr called"));
   }
+
+  /* See language.h.  */
+
+  void print_typedef (struct type *type, struct symbol *new_symbol,
+                     struct ui_file *stream) const override
+  {
+    error (_("unimplemented auto_language::print_typedef called"));
+  }
+
+  /* See language.h.  */
+
+  bool is_string_type_p (struct type *type) const override
+  {
+    return default_is_string_type_p (type);
+  }
 };
 
 /* Single instance of the fake "auto" language.  */
This page took 0.024454 seconds and 4 git commands to generate.