Tidy dwarf1 cached section contents
[binutils-gdb.git] / gdb / c-exp.h
index 1afe2d2fbee14dc9533154173ea16c6b2679cf5b..51e2d26eb2ef90f8cb1f3febe26c9f1e6e6001c7 100644 (file)
@@ -1,6 +1,6 @@
 /* Definitions for C expressions
 
-   Copyright (C) 2020 Free Software Foundation, Inc.
+   Copyright (C) 2020-2023 Free Software Foundation, Inc.
 
    This file is part of GDB.
 
@@ -74,8 +74,6 @@ public:
                   struct expression *exp,
                   enum noside noside) override
   {
-    if (noside == EVAL_SKIP)
-      return eval_skip_value (exp);
     const std::string &str = std::get<0> (m_storage);
     return value_nsstring (exp->gdbarch, str.c_str (), str.size () + 1);
   }
@@ -95,8 +93,6 @@ public:
                   struct expression *exp,
                   enum noside noside) override
   {
-    if (noside == EVAL_SKIP)
-      return eval_skip_value (exp);
     return eval_op_objc_selector (expect_type, exp, noside,
                                  std::get<0> (m_storage).c_str ());
   }
@@ -142,7 +138,7 @@ public:
     value *lhs
       = std::get<0> (this->m_storage)->evaluate (nullptr, exp, noside);
     value *rhs
-      = std::get<1> (this->m_storage)->evaluate (value_type (lhs), exp,
+      = std::get<1> (this->m_storage)->evaluate (lhs->type (), exp,
                                                 noside);
     return FUNC (expect_type, exp, noside, OP, lhs, rhs);
   }
@@ -170,6 +166,55 @@ using opencl_leq_operation = opencl_binop_operation<BINOP_LEQ,
 using opencl_not_operation = unop_operation<UNOP_LOGICAL_NOT,
                                            opencl_logical_not>;
 
+/* STRUCTOP_STRUCT implementation for OpenCL.  */
+class opencl_structop_operation
+  : public structop_base_operation
+{
+public:
+
+  using structop_base_operation::structop_base_operation;
+
+  value *evaluate (struct type *expect_type,
+                  struct expression *exp,
+                  enum noside noside) override;
+
+  enum exp_opcode opcode () const override
+  { return STRUCTOP_STRUCT; }
+};
+
+/* This handles the "&&" and "||" operations for OpenCL.  */
+class opencl_logical_binop_operation
+  : public tuple_holding_operation<enum exp_opcode,
+                                  operation_up, operation_up>
+{
+public:
+
+  using tuple_holding_operation::tuple_holding_operation;
+
+  value *evaluate (struct type *expect_type,
+                  struct expression *exp,
+                  enum noside noside) override;
+
+  enum exp_opcode opcode () const override
+  { return std::get<0> (m_storage); }
+};
+
+/* The ?: ternary operator for OpenCL.  */
+class opencl_ternop_cond_operation
+  : public tuple_holding_operation<operation_up, operation_up, operation_up>
+{
+public:
+
+  using tuple_holding_operation::tuple_holding_operation;
+
+  value *evaluate (struct type *expect_type,
+                  struct expression *exp,
+                  enum noside noside) override;
+
+  enum exp_opcode opcode () const override
+  { return TERNOP_COND; }
+};
+
 }/* namespace expr */
 
 #endif /* C_EXP_H */