aboutsummaryrefslogtreecommitdiff
path: root/gdb
diff options
context:
space:
mode:
authorTom Tromey <tom@tromey.com>2021-03-08 07:27:57 -0700
committerTom Tromey <tom@tromey.com>2021-03-08 07:28:30 -0700
commite967770468cd029b0cf0da4099eea40106aa16a3 (patch)
treee3c150b92e34cb2128be14653eede14e940a045b /gdb
parentf403a4e4a5d6413cf58f7a9ad004b1086fd2254a (diff)
downloadgdb-e967770468cd029b0cf0da4099eea40106aa16a3.zip
gdb-e967770468cd029b0cf0da4099eea40106aa16a3.tar.gz
gdb-e967770468cd029b0cf0da4099eea40106aa16a3.tar.bz2
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 <tom@tromey.com> * opencl-lang.c (opencl_value_cast): No longer static. * c-exp.h (opencl_cast_type_operation): New typedef.
Diffstat (limited to 'gdb')
-rw-r--r--gdb/ChangeLog5
-rw-r--r--gdb/c-exp.h5
-rw-r--r--gdb/opencl-lang.c3
3 files changed, 12 insertions, 1 deletions
diff --git a/gdb/ChangeLog b/gdb/ChangeLog
index 856d6ff..5abe97e 100644
--- a/gdb/ChangeLog
+++ b/gdb/ChangeLog
@@ -1,5 +1,10 @@
2021-03-08 Tom Tromey <tom@tromey.com>
+ * opencl-lang.c (opencl_value_cast): No longer static.
+ * c-exp.h (opencl_cast_type_operation): New typedef.
+
+2021-03-08 Tom Tromey <tom@tromey.com>
+
* f-exp.h (eval_op_f_allocated): Declare.
(fortran_allocated_operation): New typedef.
* f-lang.c (eval_op_f_allocated): No longer static.
diff --git a/gdb/c-exp.h b/gdb/c-exp.h
index 2d224c8..68efa62 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<UNOP_CAST_TYPE,
+ opencl_value_cast>;
+
}/* namespace expr */
#endif /* C_EXP_H */
diff --git a/gdb/opencl-lang.c b/gdb/opencl-lang.c
index b45e47e..c31eb51 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))