From: Tom Tromey Date: Mon, 8 Mar 2021 14:27:57 +0000 (-0700) Subject: Introduce opencl_cast_type_operation X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=e967770468cd029b0cf0da4099eea40106aa16a3;p=binutils-gdb.git Introduce opencl_cast_type_operation This adds class opencl_cast_type_operation, which implements UNOP_CAST_TYPE for OpenCL. gdb/ChangeLog 2021-03-08 Tom Tromey * opencl-lang.c (opencl_value_cast): No longer static. * c-exp.h (opencl_cast_type_operation): New typedef. --- diff --git a/gdb/ChangeLog b/gdb/ChangeLog index 856d6ffbf0a..5abe97e6907 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,3 +1,8 @@ +2021-03-08 Tom Tromey + + * opencl-lang.c (opencl_value_cast): No longer static. + * c-exp.h (opencl_cast_type_operation): New typedef. + 2021-03-08 Tom Tromey * f-exp.h (eval_op_f_allocated): Declare. diff --git a/gdb/c-exp.h b/gdb/c-exp.h index 2d224c8c633..68efa62c5a8 100644 --- a/gdb/c-exp.h +++ b/gdb/c-exp.h @@ -27,6 +27,8 @@ extern struct value *eval_op_objc_selector (struct type *expect_type, struct expression *exp, enum noside noside, const char *sel); +extern struct value *opencl_value_cast (struct type *type, struct value *arg); + namespace expr { @@ -105,6 +107,9 @@ public: { return OP_OBJC_MSGCALL; } }; +using opencl_cast_type_operation = cxx_cast_operation; + }/* namespace expr */ #endif /* C_EXP_H */ diff --git a/gdb/opencl-lang.c b/gdb/opencl-lang.c index b45e47eb506..c31eb51a390 100644 --- a/gdb/opencl-lang.c +++ b/gdb/opencl-lang.c @@ -27,6 +27,7 @@ #include "varobj.h" #include "c-lang.h" #include "gdbarch.h" +#include "c-exp.h" /* Returns the corresponding OpenCL vector type from the given type code, the length of the element type, the unsigned flag and the amount of @@ -581,7 +582,7 @@ vector_relop (struct expression *exp, struct value *val1, struct value *val2, behaviour of scalar to vector casting. As far as possibly we're going to try and delegate back to the standard value_cast function. */ -static struct value * +struct value * opencl_value_cast (struct type *type, struct value *arg) { if (type != value_type (arg))