Rename fprintf_symbol_filtered
[binutils-gdb.git] / gdb / eval.c
index 6ced0b261e78c7d37bdfd28345a1517f8dcb0385..1211930a377c712a239ff70a25f4029c02540dc3 100644 (file)
@@ -1078,17 +1078,22 @@ eval_op_register (struct type *expect_type, struct expression *exp,
     return val;
 }
 
-/* Helper function that implements the body of OP_STRING.  */
+namespace expr
+{
 
-struct value *
-eval_op_string (struct type *expect_type, struct expression *exp,
-               enum noside noside, int len, const char *string)
+value *
+string_operation::evaluate (struct type *expect_type,
+                           struct expression *exp,
+                           enum noside noside)
 {
+  const std::string &str = std::get<0> (m_storage);
   struct type *type = language_string_char_type (exp->language_defn,
                                                 exp->gdbarch);
-  return value_string (string, len, type);
+  return value_string (str.c_str (), str.size (), type);
 }
 
+} /* namespace expr */
+
 /* Helper function that implements the body of OP_OBJC_SELECTOR.  */
 
 struct value *
@@ -1101,18 +1106,6 @@ eval_op_objc_selector (struct type *expect_type, struct expression *exp,
                             lookup_child_selector (exp->gdbarch, sel));
 }
 
-/* Helper function that implements the body of BINOP_CONCAT.  */
-
-struct value *
-eval_op_concat (struct type *expect_type, struct expression *exp,
-               enum noside noside, struct value *arg1, struct value *arg2)
-{
-  if (binop_user_defined_p (BINOP_CONCAT, arg1, arg2))
-    return value_x_binop (arg1, arg2, BINOP_CONCAT, OP_NULL, noside);
-  else
-    return value_concat (arg1, arg2);
-}
-
 /* A helper function for TERNOP_SLICE.  */
 
 struct value *
@@ -2467,6 +2460,22 @@ array_operation::evaluate (struct type *expect_type,
   return value_array (tem2, tem3, argvec);
 }
 
+value *
+unop_extract_operation::evaluate (struct type *expect_type,
+                                 struct expression *exp,
+                                 enum noside noside)
+{
+  value *old_value = std::get<0> (m_storage)->evaluate (nullptr, exp, noside);
+  struct type *type = get_type ();
+
+  if (TYPE_LENGTH (type) > TYPE_LENGTH (value_type (old_value)))
+    error (_("length type is larger than the value type"));
+
+  struct value *result = allocate_value (type);
+  value_contents_copy (result, 0, old_value, 0, TYPE_LENGTH (type));
+  return result;
+}
+
 }
 
 \f