gdb: Convert language_data::c_style_arrays to a method
[deliverable/binutils-gdb.git] / gdb / go-lang.c
index 661cabbe54cd0adb88cc0b26b40857fea03e63eb..c2724e3d7cc06e5c8867283d302b0b324b552efd 100644 (file)
@@ -131,16 +131,6 @@ go_classify_struct_type (struct type *type)
   return GO_TYPE_NONE;
 }
 
-/* Return true if TYPE is a string.  */
-
-static bool
-go_is_string_type_p (struct type *type)
-{
-  type = check_typedef (type);
-  return (type->code () == TYPE_CODE_STRUCT
-         && go_classify_struct_type (type) == GO_TYPE_STRING);
-}
-
 /* Subroutine of unpack_mangled_go_symbol to simplify it.
    Given "[foo.]bar.baz", store "bar" in *PACKAGEP and "baz" in *OBJECTP.
    We stomp on the last '.' to nul-terminate "bar".
@@ -518,36 +508,15 @@ enum go_primitive_types {
 
 extern const struct language_data go_language_data =
 {
-  "go",
-  "Go",
-  language_go,
   range_check_off,
   case_sensitive_on,
   array_row_major,
   macro_expansion_no,
-  NULL,
   &exp_descriptor_c,
-  go_parse,
-  null_post_parser,
-  c_printchar,                 /* Print a character constant.  */
-  c_printstr,                  /* Function to print string constant.  */
-  c_emit_char,                 /* Print a single char.  */
-  c_print_typedef,             /* Print a typedef using appropriate
-                                  syntax.  */
-  go_value_print_inner,                /* la_value_print_inner */
-  c_value_print,               /* Print a top-level value.  */
-  NULL,                                /* name_of_this */
   false,                       /* la_store_sym_names_in_linkage_form_p */
-  basic_lookup_symbol_nonlocal, 
   go_op_print_tab,             /* Expression operators for printing.  */
-  1,                           /* C-style arrays.  */
   0,                           /* String lower bound.  */
-  default_word_break_characters,
-  default_collect_symbol_completion_matches,
-  c_watch_location_expression,
   &default_varobj_ops,
-  go_is_string_type_p,
-  "{...}"                      /* la_struct_too_deep_ellipsis */
 };
 
 /* Class representing the Go language.  */
@@ -559,6 +528,16 @@ public:
     : language_defn (language_go, go_language_data)
   { /* Nothing.  */ }
 
+  /* See language.h.  */
+
+  const char *name () const override
+  { return "go"; }
+
+  /* See language.h.  */
+
+  const char *natural_name () const override
+  { return "Go"; }
+
   /* See language.h.  */
   void language_arch_info (struct gdbarch *gdbarch,
                           struct language_arch_info *lai) const override
@@ -635,6 +614,32 @@ public:
   {
     go_print_type (type, varstring, stream, show, level, flags);
   }
+
+  /* See language.h.  */
+
+  void value_print_inner
+       (struct value *val, struct ui_file *stream, int recurse,
+        const struct value_print_options *options) const override
+  {
+    return go_value_print_inner (val, stream, recurse, options);
+  }
+
+  /* See language.h.  */
+
+  int parser (struct parser_state *ps) const override
+  {
+    return go_parse (ps);
+  }
+
+  /* See language.h.  */
+
+  bool is_string_type_p (struct type *type) const override
+  {
+    type = check_typedef (type);
+    return (type->code () == TYPE_CODE_STRUCT
+           && go_classify_struct_type (type) == GO_TYPE_STRING);
+  }
+
 };
 
 /* Single instance of the Go language class.  */
This page took 0.026788 seconds and 4 git commands to generate.