+/* A class for the C++ language. */
+
+class cplus_language : public language_defn
+{
+public:
+ cplus_language ()
+ : language_defn (language_cplus, cplus_language_data)
+ { /* Nothing. */ }
+
+ /* See language.h. */
+
+ struct language_pass_by_ref_info pass_by_reference_info
+ (struct type *type) const override
+ {
+ return cp_pass_by_reference (type);
+ }
+
+ /* See language.h. */
+ void language_arch_info (struct gdbarch *gdbarch,
+ struct language_arch_info *lai) const override
+ {
+ const struct builtin_type *builtin = builtin_type (gdbarch);
+
+ lai->string_char_type = builtin->builtin_char;
+ lai->primitive_type_vector
+ = GDBARCH_OBSTACK_CALLOC (gdbarch, nr_cplus_primitive_types + 1,
+ struct type *);
+ lai->primitive_type_vector [cplus_primitive_type_int]
+ = builtin->builtin_int;
+ lai->primitive_type_vector [cplus_primitive_type_long]
+ = builtin->builtin_long;
+ lai->primitive_type_vector [cplus_primitive_type_short]
+ = builtin->builtin_short;
+ lai->primitive_type_vector [cplus_primitive_type_char]
+ = builtin->builtin_char;
+ lai->primitive_type_vector [cplus_primitive_type_float]
+ = builtin->builtin_float;
+ lai->primitive_type_vector [cplus_primitive_type_double]
+ = builtin->builtin_double;
+ lai->primitive_type_vector [cplus_primitive_type_void]
+ = builtin->builtin_void;
+ lai->primitive_type_vector [cplus_primitive_type_long_long]
+ = builtin->builtin_long_long;
+ lai->primitive_type_vector [cplus_primitive_type_signed_char]
+ = builtin->builtin_signed_char;
+ lai->primitive_type_vector [cplus_primitive_type_unsigned_char]
+ = builtin->builtin_unsigned_char;
+ lai->primitive_type_vector [cplus_primitive_type_unsigned_short]
+ = builtin->builtin_unsigned_short;
+ lai->primitive_type_vector [cplus_primitive_type_unsigned_int]
+ = builtin->builtin_unsigned_int;
+ lai->primitive_type_vector [cplus_primitive_type_unsigned_long]
+ = builtin->builtin_unsigned_long;
+ lai->primitive_type_vector [cplus_primitive_type_unsigned_long_long]
+ = builtin->builtin_unsigned_long_long;
+ lai->primitive_type_vector [cplus_primitive_type_long_double]
+ = builtin->builtin_long_double;
+ lai->primitive_type_vector [cplus_primitive_type_complex]
+ = builtin->builtin_complex;
+ lai->primitive_type_vector [cplus_primitive_type_double_complex]
+ = builtin->builtin_double_complex;
+ lai->primitive_type_vector [cplus_primitive_type_bool]
+ = builtin->builtin_bool;
+ lai->primitive_type_vector [cplus_primitive_type_decfloat]
+ = builtin->builtin_decfloat;
+ lai->primitive_type_vector [cplus_primitive_type_decdouble]
+ = builtin->builtin_decdouble;
+ lai->primitive_type_vector [cplus_primitive_type_declong]
+ = builtin->builtin_declong;
+ lai->primitive_type_vector [cplus_primitive_type_char16_t]
+ = builtin->builtin_char16;
+ lai->primitive_type_vector [cplus_primitive_type_char32_t]
+ = builtin->builtin_char32;
+ lai->primitive_type_vector [cplus_primitive_type_wchar_t]
+ = builtin->builtin_wchar;
+
+ lai->bool_type_symbol = "bool";
+ lai->bool_type_default = builtin->builtin_bool;
+ }
+
+ /* See language.h. */
+ struct type *lookup_transparent_type (const char *name) const override
+ {
+ return cp_lookup_transparent_type (name);
+ }
+
+ /* See language.h. */
+ compile_instance *get_compile_instance () const override
+ {
+ return cplus_get_compile_context ();
+ }
+
+ /* See language.h. */
+ unsigned int search_name_hash (const char *name) const override
+ {
+ return cp_search_name_hash (name);
+ }
+
+ /* See language.h. */
+ bool sniff_from_mangled_name (const char *mangled,
+ char **demangled) const override
+ {
+ *demangled = gdb_demangle (mangled, DMGL_PARAMS | DMGL_ANSI);
+ return *demangled != NULL;
+ }
+
+ /* See language.h. */
+
+ char *demangle (const char *mangled, int options) const override
+ {
+ return gdb_demangle (mangled, options);
+ }
+
+ /* 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);
+ }
+
+ /* See language.h. */
+
+ CORE_ADDR skip_trampoline (struct frame_info *fi,
+ CORE_ADDR pc) const override
+ {
+ return cplus_skip_trampoline (fi, pc);
+ }
+};
+
+/* The single instance of the C++ language class. */
+
+static cplus_language cplus_language_defn;
+