+2020-06-02 Andrew Burgess <andrew.burgess@embecosm.com>
+
+ * ada-lang.c (ada_language_data): Delete la_print_type
+ initializer.
+ (ada_language::print_type): New member function.
+ * c-lang.c (c_language_data): Delete la_print_type initializer.
+ (c_language::print_type): New member function.
+ (cplus_language_data): Delete la_print_type initializer.
+ (cplus_language::print_type): New member function.
+ (asm_language_data): Delete la_print_type initializer.
+ (asm_language::print_type): New member function.
+ (minimal_language_data): Delete la_print_type initializer.
+ (minimal_language::print_type): New member function.
+ * d-lang.c (d_language_data): Delete la_print_type initializer.
+ (d_language::print_type): New member function.
+ * f-lang.c (f_language_data): Delete la_print_type initializer.
+ (f_language::print_type): New member function.
+ * go-lang.c (go_language_data): Delete la_print_type initializer.
+ (go_language::print_type): New member function.
+ * language.c (unk_lang_print_type): Delete.
+ (unknown_language_data): Delete la_print_type initializer.
+ (unknown_language::print_type): New member function.
+ (auto_language_data): Delete la_print_type initializer.
+ (auto_language::print_type): New member function.
+ * language.h (language_data): Delete la_print_type field.
+ (language_defn::print_type): New function.
+ (LA_PRINT_TYPE): Update.
+ * m2-lang.c (m2_language_data): Delete la_print_type initializer.
+ (m2_language::print_type): New member function.
+ * objc-lang.c (objc_language_data): Delete la_print_type
+ initializer.
+ (objc_language::print_type): New member function.
+ * opencl-lang.c (opencl_print_type): Delete, implementation moved
+ to opencl_language::print_type.
+ (opencl_language_data): Delete la_print_type initializer.
+ (opencl_language::print_type): New member function, implementation
+ from opencl_print_type.
+ * p-lang.c (pascal_language_data): Delete la_print_type
+ initializer.
+ (pascal_language::print_type): New member function.
+ * rust-lang.c (rust_print_type): Delete, implementation moved to
+ rust_language::print_type.
+ (rust_language_data): Delete la_print_type initializer.
+ (rust_language::print_type): New member function, implementation
+ from rust_print_type.
+
2020-06-02 Andrew Burgess <andrew.burgess@embecosm.com>
* ada-lang.c (ada_sniff_from_mangled_name): Delete function,
ada_printchar, /* Print a character constant */
ada_printstr, /* Function to print string constant */
emit_char, /* Function to print single char (not used) */
- ada_print_type, /* Print a type using appropriate syntax */
ada_print_typedef, /* Print a typedef using appropriate syntax */
ada_value_print_inner, /* la_value_print_inner */
ada_value_print, /* Print a top-level value */
return false;
}
+
+ /* 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
+ {
+ ada_print_type (type, varstring, stream, show, level, flags);
+ }
};
/* Single instance of the Ada language class. */
c_printchar, /* Print a character constant */
c_printstr, /* Function to print string constant */
c_emit_char, /* Print a single char */
- c_print_type, /* Print a type using appropriate syntax */
c_print_typedef, /* Print a typedef using appropriate syntax */
c_value_print_inner, /* la_value_print_inner */
c_value_print, /* Print a top-level value */
{
return c_get_compile_context ();
}
+
+ /* 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
+ {
+ c_print_type (type, varstring, stream, show, level, flags);
+ }
};
/* Single instance of the C language class. */
c_printchar, /* Print a character constant */
c_printstr, /* Function to print string constant */
c_emit_char, /* Print a single char */
- c_print_type, /* Print a type using appropriate syntax */
c_print_typedef, /* Print a typedef using appropriate syntax */
c_value_print_inner, /* la_value_print_inner */
c_value_print, /* Print a top-level value */
*demangled = gdb_demangle (mangled, DMGL_PARAMS | DMGL_ANSI);
return *demangled != NULL;
}
+
+ /* 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
+ {
+ c_print_type (type, varstring, stream, show, level, flags);
+ }
};
/* The single instance of the C++ language class. */
c_printchar, /* Print a character constant */
c_printstr, /* Function to print string constant */
c_emit_char, /* Print a single char */
- c_print_type, /* Print a type using appropriate syntax */
c_print_typedef, /* Print a typedef using appropriate syntax */
c_value_print_inner, /* la_value_print_inner */
c_value_print, /* Print a top-level value */
{
c_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
+ {
+ c_print_type (type, varstring, stream, show, level, flags);
+ }
};
/* The single instance of the ASM language class. */
c_printchar, /* Print a character constant */
c_printstr, /* Function to print string constant */
c_emit_char, /* Print a single char */
- c_print_type, /* Print a type using appropriate syntax */
c_print_typedef, /* Print a typedef using appropriate syntax */
c_value_print_inner, /* la_value_print_inner */
c_value_print, /* Print a top-level value */
{
c_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
+ {
+ c_print_type (type, varstring, stream, show, level, flags);
+ }
};
/* The single instance of the minimal language class. */
c_printchar, /* Print a character constant. */
c_printstr, /* Function to print string constant. */
c_emit_char, /* Print a single char. */
- c_print_type, /* Print a type using appropriate syntax. */
c_print_typedef, /* Print a typedef using appropriate
syntax. */
d_value_print_inner, /* la_value_print_inner */
*demangled = d_demangle (mangled, 0);
return *demangled != NULL;
}
+
+ /* 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
+ {
+ c_print_type (type, varstring, stream, show, level, flags);
+ }
};
/* Single instance of the D language class. */
f_printchar, /* Print character constant */
f_printstr, /* function to print string constant */
f_emit_char, /* Function to print a single character */
- f_print_type, /* Print a type using appropriate syntax */
f_print_typedef, /* Print a typedef using appropriate syntax */
f_value_print_innner, /* la_value_print_inner */
c_value_print, /* FIXME */
{
return cp_search_name_hash (name);
}
+
+ /* 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
+ {
+ f_print_type (type, varstring, stream, show, level, flags);
+ }
};
/* Single instance of the Fortran language class. */
c_printchar, /* Print a character constant. */
c_printstr, /* Function to print string constant. */
c_emit_char, /* Print a single char. */
- go_print_type, /* Print a type using appropriate syntax. */
c_print_typedef, /* Print a typedef using appropriate
syntax. */
go_value_print_inner, /* la_value_print_inner */
*demangled = go_demangle (mangled, 0);
return *demangled != NULL;
}
+
+ /* 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
+ {
+ go_print_type (type, varstring, stream, show, level, flags);
+ }
};
/* Single instance of the Go language class. */
"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,
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 */
{
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"));
+ }
};
/* Single instance of the unknown language class. */
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 */
{
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"));
+ }
};
/* Single instance of the fake "auto" language. */
void (*la_emitchar) (int ch, struct type *chtype,
struct ui_file * stream, int quoter);
- /* Print a type using syntax appropriate for this language. */
-
- void (*la_print_type) (struct type *, const char *, struct ui_file *, int,
- int, const struct type_print_options *);
-
/* Print a typedef using syntax appropriate for this language.
TYPE is the underlying type. NEW_SYMBOL is the symbol naming
the type. STREAM is the output stream on which to print. */
return false;
}
+ /* Print a type using syntax appropriate for this language. */
+
+ virtual void print_type (struct type *, const char *, struct ui_file *, int,
+ int, const struct type_print_options *) const = 0;
+
/* List of all known languages. */
static const struct language_defn *languages[nr_languages];
};
with the "set language" command. */
#define LA_PRINT_TYPE(type,varstring,stream,show,level,flags) \
- (current_language->la_print_type(type,varstring,stream,show,level,flags))
+ (current_language->print_type(type,varstring,stream,show,level,flags))
#define LA_PRINT_TYPEDEF(type,new_symbol,stream) \
(current_language->la_print_typedef(type,new_symbol,stream))
m2_printchar, /* Print character constant */
m2_printstr, /* function to print string constant */
m2_emit_char, /* Function to print a single character */
- m2_print_type, /* Print a type using appropriate syntax */
m2_print_typedef, /* Print a typedef using appropriate syntax */
m2_value_print_inner, /* la_value_print_inner */
c_value_print, /* Print a top-level value */
lai->bool_type_symbol = "BOOLEAN";
lai->bool_type_default = builtin->builtin_bool;
}
+
+ /* 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
+ {
+ m2_print_type (type, varstring, stream, show, level, flags);
+ }
};
/* Single instance of the M2 language. */
c_printchar, /* Print a character constant */
c_printstr, /* Function to print string constant */
c_emit_char,
- c_print_type, /* Print a type using appropriate syntax */
c_print_typedef, /* Print a typedef using appropriate syntax */
c_value_print_inner, /* la_value_print_inner */
c_value_print, /* Print a top-level value */
*demangled = objc_demangle (mangled, 0);
return *demangled != NULL;
}
+
+ /* 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
+ {
+ c_print_type (type, varstring, stream, show, level, flags);
+ }
};
/* Single instance of the class representing the Objective-C language. */
return evaluate_subexp_c (expect_type, exp, pos, noside);
}
-/* Print OpenCL types. */
-
-static void
-opencl_print_type (struct type *type, const char *varstring,
- struct ui_file *stream, int show, int level,
- const struct type_print_options *flags)
-{
- /* We nearly always defer to C type printing, except that vector
- types are considered primitive in OpenCL, and should always
- be printed using their TYPE_NAME. */
- if (show > 0)
- {
- type = check_typedef (type);
- if (type->code () == TYPE_CODE_ARRAY && TYPE_VECTOR (type)
- && type->name () != NULL)
- show = 0;
- }
-
- c_print_type (type, varstring, stream, show, level, flags);
-}
-
const struct exp_descriptor exp_descriptor_opencl =
{
print_subexp_standard,
c_printchar, /* Print a character constant */
c_printstr, /* Function to print string constant */
c_emit_char, /* Print a single char */
- opencl_print_type, /* Print a type using appropriate syntax */
c_print_typedef, /* Print a typedef using appropriate syntax */
c_value_print_inner, /* la_value_print_inner */
c_value_print, /* Print a top-level value */
lai->bool_type_symbol = "int";
lai->bool_type_default = types [opencl_primitive_type_int];
}
+
+ /* 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
+ {
+ /* We nearly always defer to C type printing, except that vector types
+ are considered primitive in OpenCL, and should always be printed
+ using their TYPE_NAME. */
+ if (show > 0)
+ {
+ type = check_typedef (type);
+ if (type->code () == TYPE_CODE_ARRAY && TYPE_VECTOR (type)
+ && type->name () != NULL)
+ show = 0;
+ }
+
+ c_print_type (type, varstring, stream, show, level, flags);
+ }
};
/* Single instance of the OpenCL language class. */
pascal_printchar, /* Print a character constant */
pascal_printstr, /* Function to print string constant */
pascal_emit_char, /* Print a single char */
- pascal_print_type, /* Print a type using appropriate syntax */
pascal_print_typedef, /* Print a typedef using appropriate syntax */
pascal_value_print_inner, /* la_value_print_inner */
pascal_value_print, /* Print a top-level value */
lai->bool_type_symbol = "boolean";
lai->bool_type_default = builtin->builtin_bool;
}
+
+ /* 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
+ {
+ pascal_print_type (type, varstring, stream, show, level, flags);
+ }
};
/* Single instance of the Pascal language class. */
}
}
-static void
-rust_print_type (struct type *type, const char *varstring,
- struct ui_file *stream, int show, int level,
- const struct type_print_options *flags)
-{
- print_offset_data podata;
- rust_internal_print_type (type, varstring, stream, show, level,
- flags, false, &podata);
-}
-
\f
/* Like arch_composite_type, but uses TYPE to decide how to allocate
rust_printchar, /* Print a character constant */
rust_printstr, /* Function to print string constant */
rust_emitchar, /* Print a single char */
- rust_print_type, /* Print a type using appropriate syntax */
rust_print_typedef, /* Print a typedef using appropriate syntax */
rust_value_print_inner, /* la_value_print_inner */
c_value_print, /* Print a top-level value */
*demangled = gdb_demangle (mangled, DMGL_PARAMS | DMGL_ANSI);
return *demangled != NULL;
}
+
+ /* 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
+ {
+ print_offset_data podata;
+ rust_internal_print_type (type, varstring, stream, show, level,
+ flags, false, &podata);
+ }
};
/* Single instance of the Rust language class. */