{
/* gccgo strings don't necessarily have a name we can use. */
- if (TYPE_NFIELDS (type) == 2)
+ if (type->num_fields () == 2)
{
struct type *type0 = TYPE_FIELD_TYPE (type, 0);
struct type *type1 = TYPE_FIELD_TYPE (type, 1);
type0 = check_typedef (type0);
type1 = check_typedef (type1);
- if (TYPE_CODE (type0) == TYPE_CODE_PTR
+ if (type0->code () == TYPE_CODE_PTR
&& strcmp (TYPE_FIELD_NAME (type, 0), "__data") == 0
- && TYPE_CODE (type1) == TYPE_CODE_INT
+ && type1->code () == TYPE_CODE_INT
&& strcmp (TYPE_FIELD_NAME (type, 1), "__length") == 0)
{
struct type *target_type = TYPE_TARGET_TYPE (type0);
target_type = check_typedef (target_type);
- if (TYPE_CODE (target_type) == TYPE_CODE_INT
+ if (target_type->code () == TYPE_CODE_INT
&& TYPE_LENGTH (target_type) == 1
- && strcmp (TYPE_NAME (target_type), "uint8") == 0)
+ && strcmp (target_type->name (), "uint8") == 0)
return 1;
}
}
static int
sixg_string_p (struct type *type)
{
- if (TYPE_NFIELDS (type) == 2
- && TYPE_NAME (type) != NULL
- && strcmp (TYPE_NAME (type), "string") == 0)
+ if (type->num_fields () == 2
+ && type->name () != NULL
+ && strcmp (type->name (), "string") == 0)
return 1;
return 0;
go_is_string_type_p (struct type *type)
{
type = check_typedef (type);
- return (TYPE_CODE (type) == TYPE_CODE_STRUCT
+ return (type->code () == TYPE_CODE_STRUCT
&& go_classify_struct_type (type) == GO_TYPE_STRING);
}
lai->bool_type_default = builtin->builtin_bool;
}
-extern const struct language_defn go_language_defn =
+/* Constant data that describes the Go language. */
+
+extern const struct language_data go_language_data =
{
"go",
"Go",
go_print_type, /* Print a type using appropriate syntax. */
c_print_typedef, /* Print a typedef using appropriate
syntax. */
- go_val_print, /* Print a value using appropriate syntax. */
go_value_print_inner, /* la_value_print_inner */
c_value_print, /* Print a top-level value. */
- default_read_var_value, /* la_read_var_value */
NULL, /* Language specific skip_trampoline. */
NULL, /* name_of_this */
false, /* la_store_sym_names_in_linkage_form_p */
default_word_break_characters,
default_collect_symbol_completion_matches,
go_language_arch_info,
- default_print_array_index,
- default_pass_by_reference,
c_watch_location_expression,
NULL, /* la_get_symbol_name_matcher */
iterate_over_symbols,
"{...}" /* la_struct_too_deep_ellipsis */
};
+/* Class representing the Go language. */
+
+class go_language : public language_defn
+{
+public:
+ go_language ()
+ : language_defn (language_go, go_language_data)
+ { /* Nothing. */ }
+};
+
+/* Single instance of the Go language class. */
+
+static go_language go_language_defn;
+
static void *
build_go_types (struct gdbarch *gdbarch)
{
builtin_go_type->builtin_float64
= arch_float_type (gdbarch, 64, "float64", floatformats_ieee_double);
builtin_go_type->builtin_complex64
- = arch_complex_type (gdbarch, "complex64",
- builtin_go_type->builtin_float32);
+ = init_complex_type ("complex64", builtin_go_type->builtin_float32);
builtin_go_type->builtin_complex128
- = arch_complex_type (gdbarch, "complex128",
- builtin_go_type->builtin_float64);
+ = init_complex_type ("complex128", builtin_go_type->builtin_float64);
return builtin_go_type;
}