X-Git-Url: http://git.efficios.com/?a=blobdiff_plain;f=gdb%2Fopencl-lang.c;h=eaf61c3fc1aad18e7bf3bcf4e81a75946fbdd300;hb=refs%2Fheads%2Fconcurrent-displaced-stepping-2020-04-01;hp=d7476f7d285a10ddbd9d7556838be0601dfce1d7;hpb=48448202d7e607d7423c6186438099f442732a95;p=deliverable%2Fbinutils-gdb.git diff --git a/gdb/opencl-lang.c b/gdb/opencl-lang.c index d7476f7d28..eaf61c3fc1 100644 --- a/gdb/opencl-lang.c +++ b/gdb/opencl-lang.c @@ -994,44 +994,6 @@ Cannot perform conditional operation on vectors with different sizes")); 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); -} - -static void -opencl_language_arch_info (struct gdbarch *gdbarch, - struct language_arch_info *lai) -{ - struct type **types = builtin_opencl_type (gdbarch); - - /* Copy primitive types vector from gdbarch. */ - lai->primitive_type_vector = types; - - /* Type of elements of strings. */ - lai->string_char_type = types [opencl_primitive_type_char]; - - /* Specifies the return type of logical and relational operations. */ - lai->bool_type_symbol = "int"; - lai->bool_type_default = types [opencl_primitive_type_int]; -} - const struct exp_descriptor exp_descriptor_opencl = { print_subexp_standard, @@ -1059,17 +1021,12 @@ extern const struct language_data opencl_language_data = 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 */ - NULL, /* Language specific skip_trampoline */ NULL, /* name_of_this */ false, /* la_store_sym_names_in_linkage_form_p */ basic_lookup_symbol_nonlocal, /* lookup_symbol_nonlocal */ - basic_lookup_transparent_type,/* lookup_transparent_type */ - NULL, /* Language specific symbol demangler */ - NULL, NULL, /* Language specific class_name_from_physname */ c_op_print_tab, /* expression operators for printing */ @@ -1077,14 +1034,10 @@ extern const struct language_data opencl_language_data = 0, /* String lower bound */ default_word_break_characters, default_collect_symbol_completion_matches, - opencl_language_arch_info, c_watch_location_expression, NULL, /* la_get_symbol_name_matcher */ - iterate_over_symbols, - default_search_name_hash, &default_varobj_ops, NULL, - NULL, c_is_string_type_p, "{...}" /* la_struct_too_deep_ellipsis */ }; @@ -1097,6 +1050,43 @@ public: opencl_language () : language_defn (language_opencl, opencl_language_data) { /* Nothing. */ } + + /* See language.h. */ + void language_arch_info (struct gdbarch *gdbarch, + struct language_arch_info *lai) const override + { + struct type **types = builtin_opencl_type (gdbarch); + + /* Copy primitive types vector from gdbarch. */ + lai->primitive_type_vector = types; + + /* Type of elements of strings. */ + lai->string_char_type = types [opencl_primitive_type_char]; + + /* Specifies the return type of logical and relational operations. */ + 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. */