diff options
Diffstat (limited to 'gdb/eval.c')
-rw-r--r-- | gdb/eval.c | 633 |
1 files changed, 280 insertions, 353 deletions
@@ -25,7 +25,7 @@ #include "target.h" #include "frame.h" #include "gdbthread.h" -#include "language.h" /* For CAST_IS_CONVERSION. */ +#include "language.h" /* For CAST_IS_CONVERSION. */ #include "cp-abi.h" #include "infcall.h" #include "objc-lang.h" @@ -44,7 +44,6 @@ #include "c-exp.h" #include "inferior.h" - /* Parse the string EXP as a C expression, evaluate it, and return the result as a number. */ @@ -85,7 +84,6 @@ parse_to_comma_and_eval (const char **expp) return evaluate_expression (expr.get ()); } - /* See expression.h. */ @@ -156,8 +154,7 @@ evaluate_type (struct expression *exp) values will be left on the value chain. */ void -fetch_subexp_value (struct expression *exp, - expr::operation *op, +fetch_subexp_value (struct expression *exp, expr::operation *op, struct value **valp, struct value **resultp, std::vector<value_ref_ptr> *val_chain, bool preserve_errors) @@ -209,7 +206,6 @@ fetch_subexp_value (struct expression *exp, *valp = result; else { - try { value_fetch_lazy (result); @@ -281,8 +277,7 @@ binop_promote (const struct language_defn *language, struct gdbarch *gdbarch, type1 = check_typedef (value_type (*arg1)); type2 = check_typedef (value_type (*arg2)); - if ((type1->code () != TYPE_CODE_FLT - && type1->code () != TYPE_CODE_DECFLOAT + if ((type1->code () != TYPE_CODE_FLT && type1->code () != TYPE_CODE_DECFLOAT && !is_integral_type (type1)) || (type2->code () != TYPE_CODE_FLT && type2->code () != TYPE_CODE_DECFLOAT @@ -297,8 +292,7 @@ binop_promote (const struct language_defn *language, struct gdbarch *gdbarch, { /* No promotion required. */ } - else if (type1->code () == TYPE_CODE_FLT - || type2->code () == TYPE_CODE_FLT) + else if (type1->code () == TYPE_CODE_FLT || type2->code () == TYPE_CODE_FLT) { switch (language->la_language) { @@ -377,39 +371,37 @@ binop_promote (const struct language_defn *language, struct gdbarch *gdbarch, case language_objc: if (result_len <= builtin->builtin_int->length ()) { - promoted_type = (unsigned_operation - ? builtin->builtin_unsigned_int - : builtin->builtin_int); + promoted_type + = (unsigned_operation ? builtin->builtin_unsigned_int + : builtin->builtin_int); } else if (result_len <= builtin->builtin_long->length ()) { - promoted_type = (unsigned_operation - ? builtin->builtin_unsigned_long - : builtin->builtin_long); + promoted_type + = (unsigned_operation ? builtin->builtin_unsigned_long + : builtin->builtin_long); } else { - promoted_type = (unsigned_operation - ? builtin->builtin_unsigned_long_long - : builtin->builtin_long_long); + promoted_type + = (unsigned_operation ? builtin->builtin_unsigned_long_long + : builtin->builtin_long_long); } break; case language_opencl: if (result_len - <= lookup_signed_typename (language, "int")->length()) + <= lookup_signed_typename (language, "int")->length ()) { - promoted_type = - (unsigned_operation - ? lookup_unsigned_typename (language, "int") - : lookup_signed_typename (language, "int")); + promoted_type = (unsigned_operation + ? lookup_unsigned_typename (language, "int") + : lookup_signed_typename (language, "int")); } else if (result_len - <= lookup_signed_typename (language, "long")->length()) + <= lookup_signed_typename (language, "long")->length ()) { - promoted_type = - (unsigned_operation - ? lookup_unsigned_typename (language, "long") - : lookup_signed_typename (language,"long")); + promoted_type = (unsigned_operation + ? lookup_unsigned_typename (language, "long") + : lookup_signed_typename (language, "long")); } break; default: @@ -473,20 +465,25 @@ ptrmath_type_p (const struct language_defn *lang, struct type *type) class fake_method { public: - fake_method (type_instance_flags flags, - int num_types, struct type **param_types); + + fake_method (type_instance_flags flags, int num_types, + struct type **param_types); ~fake_method (); /* The constructed type. */ struct type *type () { return &m_type; } private: - struct type m_type {}; + + struct type m_type + { + }; + main_type m_main_type {}; }; -fake_method::fake_method (type_instance_flags flags, - int num_types, struct type **param_types) +fake_method::fake_method (type_instance_flags flags, int num_types, + struct type **param_types) { struct type *type = &m_type; @@ -517,8 +514,8 @@ fake_method::fake_method (type_instance_flags flags, allocate memory for auxiliary fields, and free the memory ourselves when we are done with it. */ type->set_num_fields (num_types); - type->set_fields - ((struct field *) xzalloc (sizeof (struct field) * num_types)); + type->set_fields ((struct field *) xzalloc (sizeof (struct field) + * num_types)); while (num_types-- > 0) type->field (num_types).set_type (param_types[num_types]); @@ -534,18 +531,17 @@ namespace expr value * type_instance_operation::evaluate (struct type *expect_type, - struct expression *exp, - enum noside noside) + struct expression *exp, enum noside noside) { type_instance_flags flags = std::get<0> (m_storage); std::vector<type *> &types = std::get<1> (m_storage); fake_method fake_expect_type (flags, types.size (), types.data ()); - return std::get<2> (m_storage)->evaluate (fake_expect_type.type (), - exp, noside); + return std::get<2> (m_storage)->evaluate (fake_expect_type.type (), exp, + noside); } -} +} // namespace expr /* Helper for evaluating an OP_VAR_VALUE. */ @@ -585,8 +581,7 @@ namespace expr value * var_value_operation::evaluate (struct type *expect_type, - struct expression *exp, - enum noside noside) + struct expression *exp, enum noside noside) { symbol *var = std::get<0> (m_storage).symbol; if (var->type ()->code () == TYPE_CODE_ERROR) @@ -599,8 +594,8 @@ var_value_operation::evaluate (struct type *expect_type, /* Helper for evaluating an OP_VAR_MSYM_VALUE. */ value * -evaluate_var_msym_value (enum noside noside, - struct objfile *objfile, minimal_symbol *msymbol) +evaluate_var_msym_value (enum noside noside, struct objfile *objfile, + minimal_symbol *msymbol) { CORE_ADDR address; type *the_type = find_minsym_type_and_address (msymbol, objfile, &address); @@ -614,14 +609,12 @@ evaluate_var_msym_value (enum noside noside, /* See expression.h. */ value * -evaluate_subexp_do_call (expression *exp, enum noside noside, - value *callee, +evaluate_subexp_do_call (expression *exp, enum noside noside, value *callee, gdb::array_view<value *> argvec, - const char *function_name, - type *default_return_type) + const char *function_name, type *default_return_type) { if (callee == NULL) - error (_("Cannot evaluate function -- may be inlined")); + error (_ ("Cannot evaluate function -- may be inlined")); if (noside == EVAL_AVOID_SIDE_EFFECTS) { /* If the return type doesn't look like a function type, @@ -643,7 +636,7 @@ evaluate_subexp_do_call (expression *exp, enum noside noside, type *return_type = result_type_of_xmethod (callee, argvec); if (return_type == NULL) - error (_("Xmethod is missing return type.")); + error (_ ("Xmethod is missing return type.")); return value_zero (return_type, not_lval); } else if (ftype->code () == TYPE_CODE_FUNC @@ -669,14 +662,14 @@ evaluate_subexp_do_call (expression *exp, enum noside noside, return allocate_value (return_type); } else - error (_("Expression of type other than " - "\"Function returning ...\" used as function")); + error (_ ("Expression of type other than " + "\"Function returning ...\" used as function")); } switch (value_type (callee)->code ()) { case TYPE_CODE_INTERNAL_FUNCTION: - return call_internal_function (exp->gdbarch, exp->language_defn, - callee, argvec.size (), argvec.data ()); + return call_internal_function (exp->gdbarch, exp->language_defn, callee, + argvec.size (), argvec.data ()); case TYPE_CODE_XMETHOD: return call_xmethod (callee, argvec); default: @@ -688,10 +681,8 @@ namespace expr { value * -operation::evaluate_funcall (struct type *expect_type, - struct expression *exp, - enum noside noside, - const char *function_name, +operation::evaluate_funcall (struct type *expect_type, struct expression *exp, + enum noside noside, const char *function_name, const std::vector<operation_up> &args) { std::vector<value *> vals (args.size ()); @@ -708,8 +699,8 @@ operation::evaluate_funcall (struct type *expect_type, vals[i] = args[i]->evaluate_with_coercion (exp, noside); } - return evaluate_subexp_do_call (exp, noside, callee, vals, - function_name, expect_type); + return evaluate_subexp_do_call (exp, noside, callee, vals, function_name, + expect_type); } value * @@ -727,23 +718,22 @@ var_value_operation::evaluate_funcall (struct type *expect_type, argvec[i] = args[i]->evaluate_with_coercion (exp, noside); struct symbol *symp; - find_overload_match (argvec, NULL, NON_METHOD, - NULL, std::get<0> (m_storage).symbol, - NULL, &symp, NULL, 0, noside); + find_overload_match (argvec, NULL, NON_METHOD, NULL, + std::get<0> (m_storage).symbol, NULL, &symp, NULL, 0, + noside); if (symp->type ()->code () == TYPE_CODE_ERROR) error_unknown_type (symp->print_name ()); - value *callee = evaluate_var_value (noside, std::get<0> (m_storage).block, - symp); + value *callee + = evaluate_var_value (noside, std::get<0> (m_storage).block, symp); - return evaluate_subexp_do_call (exp, noside, callee, argvec, - nullptr, expect_type); + return evaluate_subexp_do_call (exp, noside, callee, argvec, nullptr, + expect_type); } value * scope_operation::evaluate_funcall (struct type *expect_type, - struct expression *exp, - enum noside noside, + struct expression *exp, enum noside noside, const std::vector<operation_up> &args) { if (!overload_resolution @@ -760,13 +750,13 @@ scope_operation::evaluate_funcall (struct type *expect_type, std::vector<value *> argvec (1 + args.size ()); if (type->code () == TYPE_CODE_NAMESPACE) { - function = cp_lookup_symbol_namespace (type->name (), - name.c_str (), - get_selected_block (0), - VAR_DOMAIN).symbol; + function + = cp_lookup_symbol_namespace (type->name (), name.c_str (), + get_selected_block (0), VAR_DOMAIN) + .symbol; if (function == NULL) - error (_("No symbol \"%s\" in namespace \"%s\"."), - name.c_str (), type->name ()); + error (_ ("No symbol \"%s\" in namespace \"%s\"."), name.c_str (), + type->name ()); } else { @@ -787,14 +777,14 @@ scope_operation::evaluate_funcall (struct type *expect_type, { int static_memfuncp; - find_overload_match (arg_view, function_name, METHOD, - &argvec[0], nullptr, &callee, nullptr, - &static_memfuncp, 0, noside); + find_overload_match (arg_view, function_name, METHOD, &argvec[0], + nullptr, &callee, nullptr, &static_memfuncp, 0, + noside); if (!static_memfuncp) { /* For the time being, we don't handle this. */ - error (_("Call to overloaded function %s requires " - "`this' pointer"), + error (_ ("Call to overloaded function %s requires " + "`this' pointer"), function_name); } @@ -804,14 +794,13 @@ scope_operation::evaluate_funcall (struct type *expect_type, { symbol *symp; arg_view = arg_view.slice (1); - find_overload_match (arg_view, nullptr, - NON_METHOD, nullptr, function, + find_overload_match (arg_view, nullptr, NON_METHOD, nullptr, function, nullptr, &symp, nullptr, 1, noside); callee = value_of_variable (symp, get_selected_block (0)); } - return evaluate_subexp_do_call (exp, noside, callee, arg_view, - nullptr, expect_type); + return evaluate_subexp_do_call (exp, noside, callee, arg_view, nullptr, + expect_type); } value * @@ -848,8 +837,7 @@ structop_member_base::evaluate_funcall (struct type *expect_type, } else if (a1_type->code () == TYPE_CODE_MEMBERPTR) { - struct type *type_ptr - = lookup_pointer_type (TYPE_SELF_TYPE (a1_type)); + struct type *type_ptr = lookup_pointer_type (TYPE_SELF_TYPE (a1_type)); struct type *target_type_ptr = lookup_pointer_type (a1_type->target_type ()); @@ -865,21 +853,20 @@ structop_member_base::evaluate_funcall (struct type *expect_type, val_view = val_view.slice (1); } else - error (_("Non-pointer-to-member value used in pointer-to-member " - "construct")); + error (_ ("Non-pointer-to-member value used in pointer-to-member " + "construct")); for (int i = 0; i < args.size (); ++i) vals[i + 1] = args[i]->evaluate_with_coercion (exp, noside); - return evaluate_subexp_do_call (exp, noside, callee, val_view, - nullptr, expect_type); - + return evaluate_subexp_do_call (exp, noside, callee, val_view, nullptr, + expect_type); } value * -structop_base_operation::evaluate_funcall - (struct type *expect_type, struct expression *exp, enum noside noside, - const std::vector<operation_up> &args) +structop_base_operation::evaluate_funcall ( + struct type *expect_type, struct expression *exp, enum noside noside, + const std::vector<operation_up> &args) { /* Allocate space for the function call arguments, Including space for a `this' pointer at the start. */ @@ -940,15 +927,13 @@ structop_base_operation::evaluate_funcall int static_memfuncp; value *callee; const char *tstr = std::get<1> (m_storage).c_str (); - if (overload_resolution - && exp->language_defn->la_language == language_cplus) + if (overload_resolution && exp->language_defn->la_language == language_cplus) { /* Language is C++, do some overload resolution before evaluation. */ value *val0 = vals[0]; - find_overload_match (arg_view, tstr, METHOD, - &val0, nullptr, &callee, nullptr, - &static_memfuncp, 0, noside); + find_overload_match (arg_view, tstr, METHOD, &val0, nullptr, &callee, + nullptr, &static_memfuncp, 0, noside); vals[0] = val0; } else @@ -956,24 +941,23 @@ structop_base_operation::evaluate_funcall { struct value *temp = vals[0]; - callee = value_struct_elt (&temp, arg_view, tstr, - &static_memfuncp, - op == STRUCTOP_STRUCT - ? "structure" : "structure pointer"); + callee = value_struct_elt (&temp, arg_view, tstr, &static_memfuncp, + op == STRUCTOP_STRUCT ? "structure" + : "structure pointer"); /* value_struct_elt updates temp with the correct value of the ``this'' pointer if necessary, so modify it to reflect any ``this'' changes. */ vals[0] = value_from_longest (lookup_pointer_type (value_type (temp)), value_address (temp) - + value_embedded_offset (temp)); + + value_embedded_offset (temp)); } /* Take out `this' if needed. */ if (static_memfuncp) arg_view = arg_view.slice (1); - return evaluate_subexp_do_call (exp, noside, callee, arg_view, - nullptr, expect_type); + return evaluate_subexp_do_call (exp, noside, callee, arg_view, nullptr, + expect_type); } /* Helper for structop_base_operation::complete which recursively adds @@ -992,22 +976,21 @@ add_struct_fields (struct type *type, completion_list &output, for (i = 0; i < type->num_fields (); ++i) { if (i < TYPE_N_BASECLASSES (type)) - add_struct_fields (TYPE_BASECLASS (type, i), - output, fieldname, namelen, prefix); + add_struct_fields (TYPE_BASECLASS (type, i), output, fieldname, + namelen, prefix); else if (type->field (i).name ()) { if (type->field (i).name ()[0] != '\0') { - if (! strncmp (type->field (i).name (), - fieldname, namelen)) + if (!strncmp (type->field (i).name (), fieldname, namelen)) output.emplace_back (concat (prefix, type->field (i).name (), nullptr)); } else if (type->field (i).type ()->code () == TYPE_CODE_UNION) { /* Recurse into anonymous unions. */ - add_struct_fields (type->field (i).type (), - output, fieldname, namelen, prefix); + add_struct_fields (type->field (i).type (), output, fieldname, + namelen, prefix); } } } @@ -1016,7 +999,7 @@ add_struct_fields (struct type *type, completion_list &output, { const char *name = TYPE_FN_FIELDLIST_NAME (type, i); - if (name && ! strncmp (name, fieldname, namelen)) + if (name && !strncmp (name, fieldname, namelen)) { if (!computed_type_name) { @@ -1050,13 +1033,12 @@ structop_base_operation::complete (struct expression *exp, type = type->target_type (); } - if (type->code () == TYPE_CODE_UNION - || type->code () == TYPE_CODE_STRUCT) + if (type->code () == TYPE_CODE_UNION || type->code () == TYPE_CODE_STRUCT) { completion_list result; - add_struct_fields (type, result, fieldname.c_str (), - fieldname.length (), prefix); + add_struct_fields (type, result, fieldname.c_str (), fieldname.length (), + prefix); tracker.add_completions (std::move (result)); return true; } @@ -1075,8 +1057,7 @@ is_integral_or_integral_reference (struct type *type) return true; type = check_typedef (type); - return (type != nullptr - && TYPE_IS_REFERENCE (type) + return (type != nullptr && TYPE_IS_REFERENCE (type) && is_integral_type (type->target_type ())); } @@ -1084,13 +1065,12 @@ is_integral_or_integral_reference (struct type *type) struct value * eval_op_scope (struct type *expect_type, struct expression *exp, - enum noside noside, - struct type *type, const char *string) + enum noside noside, struct type *type, const char *string) { - struct value *arg1 = value_aggregate_elt (type, string, expect_type, - 0, noside); + struct value *arg1 + = value_aggregate_elt (type, string, expect_type, 0, noside); if (arg1 == NULL) - error (_("There is no field named %s"), string); + error (_ ("There is no field named %s"), string); return arg1; } @@ -1105,7 +1085,7 @@ eval_op_var_entry_value (struct type *expect_type, struct expression *exp, if (SYMBOL_COMPUTED_OPS (sym) == NULL || SYMBOL_COMPUTED_OPS (sym)->read_variable_at_entry == NULL) - error (_("Symbol \"%s\" does not have any specific entry value"), + error (_ ("Symbol \"%s\" does not have any specific entry value"), sym->print_name ()); frame_info_ptr frame = get_selected_frame (NULL); @@ -1119,8 +1099,8 @@ eval_op_var_msym_value (struct type *expect_type, struct expression *exp, enum noside noside, bool outermost_p, bound_minimal_symbol msymbol) { - value *val = evaluate_var_msym_value (noside, msymbol.objfile, - msymbol.minsym); + value *val + = evaluate_var_msym_value (noside, msymbol.objfile, msymbol.minsym); struct type *type = value_type (val); if (type->code () == TYPE_CODE_ERROR @@ -1133,14 +1113,13 @@ eval_op_var_msym_value (struct type *expect_type, struct expression *exp, struct value * eval_op_func_static_var (struct type *expect_type, struct expression *exp, - enum noside noside, - value *func, const char *var) + enum noside noside, value *func, const char *var) { CORE_ADDR addr = value_address (func); const block *blk = block_for_pc (addr); struct block_symbol sym = lookup_symbol (var, blk, VAR_DOMAIN, NULL); if (sym.symbol == NULL) - error (_("No symbol \"%s\" in specified context."), var); + error (_ ("No symbol \"%s\" in specified context."), var); return evaluate_var_value (noside, sym.block, sym.symbol); } @@ -1153,10 +1132,9 @@ eval_op_register (struct type *expect_type, struct expression *exp, int regno; struct value *val; - regno = user_reg_map_name_to_regnum (exp->gdbarch, - name, strlen (name)); + regno = user_reg_map_name_to_regnum (exp->gdbarch, name, strlen (name)); if (regno == -1) - error (_("Register $%s not available."), name); + error (_ ("Register $%s not available."), name); /* In EVAL_AVOID_SIDE_EFFECTS mode, we only need to return a value with the appropriate register type. Unfortunately, @@ -1169,7 +1147,7 @@ eval_op_register (struct type *expect_type, struct expression *exp, else val = value_of_register (regno, get_selected_frame (NULL)); if (val == NULL) - error (_("Value of register %s not available."), name); + error (_ ("Value of register %s not available."), name); else return val; } @@ -1178,13 +1156,12 @@ namespace expr { value * -string_operation::evaluate (struct type *expect_type, - struct expression *exp, +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); + struct type *type + = language_string_char_type (exp->language_defn, exp->gdbarch); return value_string (str.c_str (), str.size (), type); } @@ -1194,8 +1171,7 @@ string_operation::evaluate (struct type *expect_type, struct value * eval_op_objc_selector (struct type *expect_type, struct expression *exp, - enum noside noside, - const char *sel) + enum noside noside, const char *sel) { struct type *selector_type = builtin_type (exp->gdbarch)->builtin_data_ptr; return value_from_longest (selector_type, @@ -1206,8 +1182,8 @@ eval_op_objc_selector (struct type *expect_type, struct expression *exp, struct value * eval_op_ternop (struct type *expect_type, struct expression *exp, - enum noside noside, - struct value *array, struct value *low, struct value *upper) + enum noside noside, struct value *array, struct value *low, + struct value *upper) { int lowbound = value_as_long (low); int upperbound = value_as_long (upper); @@ -1218,11 +1194,10 @@ eval_op_ternop (struct type *expect_type, struct expression *exp, struct value * eval_op_structop_struct (struct type *expect_type, struct expression *exp, - enum noside noside, - struct value *arg1, const char *string) + enum noside noside, struct value *arg1, + const char *string) { - struct value *arg3 = value_struct_elt (&arg1, {}, string, - NULL, "structure"); + struct value *arg3 = value_struct_elt (&arg1, {}, string, NULL, "structure"); if (noside == EVAL_AVOID_SIDE_EFFECTS) arg3 = value_zero (value_type (arg3), VALUE_LVAL (arg3)); return arg3; @@ -1232,8 +1207,8 @@ eval_op_structop_struct (struct type *expect_type, struct expression *exp, struct value * eval_op_structop_ptr (struct type *expect_type, struct expression *exp, - enum noside noside, - struct value *arg1, const char *string) + enum noside noside, struct value *arg1, + const char *string) { /* Check to see if operator '->' has been overloaded. If so replace arg1 with the value returned by evaluating operator->(). */ @@ -1270,15 +1245,14 @@ eval_op_structop_ptr (struct type *expect_type, struct expression *exp, if (opts.objectprint && arg_type->target_type () && (arg_type->target_type ()->code () == TYPE_CODE_STRUCT)) { - real_type = value_rtti_indirect_type (arg1, &full, &top, - &using_enc); + real_type = value_rtti_indirect_type (arg1, &full, &top, &using_enc); if (real_type) arg1 = value_cast (real_type, arg1); } } - struct value *arg3 = value_struct_elt (&arg1, {}, string, - NULL, "structure pointer"); + struct value *arg3 + = value_struct_elt (&arg1, {}, string, NULL, "structure pointer"); if (noside == EVAL_AVOID_SIDE_EFFECTS) arg3 = value_zero (value_type (arg3), VALUE_LVAL (arg3)); return arg3; @@ -1288,8 +1262,7 @@ eval_op_structop_ptr (struct type *expect_type, struct expression *exp, struct value * eval_op_member (struct type *expect_type, struct expression *exp, - enum noside noside, - struct value *arg1, struct value *arg2) + enum noside noside, struct value *arg1, struct value *arg2) { long mem_offset; @@ -1321,8 +1294,8 @@ eval_op_member (struct type *expect_type, struct expression *exp, return value_ind (arg3); default: - error (_("non-pointer-to-member value used " - "in pointer-to-member construct")); + error (_ ("non-pointer-to-member value used " + "in pointer-to-member construct")); } } @@ -1330,8 +1303,7 @@ eval_op_member (struct type *expect_type, struct expression *exp, struct value * eval_op_add (struct type *expect_type, struct expression *exp, - enum noside noside, - struct value *arg1, struct value *arg2) + enum noside noside, struct value *arg1, struct value *arg2) { if (binop_user_defined_p (BINOP_ADD, arg1, arg2)) return value_x_binop (arg1, arg2, BINOP_ADD, OP_NULL, noside); @@ -1352,8 +1324,7 @@ eval_op_add (struct type *expect_type, struct expression *exp, struct value * eval_op_sub (struct type *expect_type, struct expression *exp, - enum noside noside, - struct value *arg1, struct value *arg2) + enum noside noside, struct value *arg1, struct value *arg2) { if (binop_user_defined_p (BINOP_SUB, arg1, arg2)) return value_x_binop (arg1, arg2, BINOP_SUB, OP_NULL, noside); @@ -1366,7 +1337,7 @@ eval_op_sub (struct type *expect_type, struct expression *exp, } else if (ptrmath_type_p (exp->language_defn, value_type (arg1)) && is_integral_or_integral_reference (value_type (arg2))) - return value_ptradd (arg1, - value_as_long (arg2)); + return value_ptradd (arg1, -value_as_long (arg2)); else { binop_promote (exp->language_defn, exp->gdbarch, &arg1, &arg2); @@ -1378,8 +1349,8 @@ eval_op_sub (struct type *expect_type, struct expression *exp, struct value * eval_op_binary (struct type *expect_type, struct expression *exp, - enum noside noside, enum exp_opcode op, - struct value *arg1, struct value *arg2) + enum noside noside, enum exp_opcode op, struct value *arg1, + struct value *arg2) { if (binop_user_defined_p (op, arg1, arg2)) return value_x_binop (arg1, arg2, op, OP_NULL, noside); @@ -1392,9 +1363,7 @@ eval_op_binary (struct type *expect_type, struct expression *exp, /* ??? Do we really want to test for BINOP_MOD here? The implementation of value_binop gives it a well-defined value. */ - && (op == BINOP_DIV - || op == BINOP_INTDIV - || op == BINOP_REM + && (op == BINOP_DIV || op == BINOP_INTDIV || op == BINOP_REM || op == BINOP_MOD) && value_logical_not (arg2)) { @@ -1423,8 +1392,8 @@ eval_op_binary (struct type *expect_type, struct expression *exp, struct value * eval_op_subscript (struct type *expect_type, struct expression *exp, - enum noside noside, enum exp_opcode op, - struct value *arg1, struct value *arg2) + enum noside noside, enum exp_opcode op, struct value *arg1, + struct value *arg2) { if (binop_user_defined_p (op, arg1, arg2)) return value_x_binop (arg1, arg2, op, OP_NULL, noside); @@ -1436,14 +1405,13 @@ eval_op_subscript (struct type *expect_type, struct expression *exp, arg1 = coerce_ref (arg1); struct type *type = check_typedef (value_type (arg1)); - if (type->code () != TYPE_CODE_ARRAY - && type->code () != TYPE_CODE_PTR) + if (type->code () != TYPE_CODE_ARRAY && type->code () != TYPE_CODE_PTR) { if (type->name ()) - error (_("cannot subscript something of type `%s'"), + error (_ ("cannot subscript something of type `%s'"), type->name ()); else - error (_("cannot subscript requested type")); + error (_ ("cannot subscript requested type")); } if (noside == EVAL_AVOID_SIDE_EFFECTS) @@ -1457,8 +1425,8 @@ eval_op_subscript (struct type *expect_type, struct expression *exp, struct value * eval_op_equal (struct type *expect_type, struct expression *exp, - enum noside noside, enum exp_opcode op, - struct value *arg1, struct value *arg2) + enum noside noside, enum exp_opcode op, struct value *arg1, + struct value *arg2) { if (binop_user_defined_p (op, arg1, arg2)) { @@ -1468,8 +1436,8 @@ eval_op_equal (struct type *expect_type, struct expression *exp, { binop_promote (exp->language_defn, exp->gdbarch, &arg1, &arg2); int tem = value_equal (arg1, arg2); - struct type *type = language_bool_type (exp->language_defn, - exp->gdbarch); + struct type *type + = language_bool_type (exp->language_defn, exp->gdbarch); return value_from_longest (type, (LONGEST) tem); } } @@ -1478,8 +1446,8 @@ eval_op_equal (struct type *expect_type, struct expression *exp, struct value * eval_op_notequal (struct type *expect_type, struct expression *exp, - enum noside noside, enum exp_opcode op, - struct value *arg1, struct value *arg2) + enum noside noside, enum exp_opcode op, struct value *arg1, + struct value *arg2) { if (binop_user_defined_p (op, arg1, arg2)) { @@ -1489,9 +1457,9 @@ eval_op_notequal (struct type *expect_type, struct expression *exp, { binop_promote (exp->language_defn, exp->gdbarch, &arg1, &arg2); int tem = value_equal (arg1, arg2); - struct type *type = language_bool_type (exp->language_defn, - exp->gdbarch); - return value_from_longest (type, (LONGEST) ! tem); + struct type *type + = language_bool_type (exp->language_defn, exp->gdbarch); + return value_from_longest (type, (LONGEST) !tem); } } @@ -1499,8 +1467,8 @@ eval_op_notequal (struct type *expect_type, struct expression *exp, struct value * eval_op_less (struct type *expect_type, struct expression *exp, - enum noside noside, enum exp_opcode op, - struct value *arg1, struct value *arg2) + enum noside noside, enum exp_opcode op, struct value *arg1, + struct value *arg2) { if (binop_user_defined_p (op, arg1, arg2)) { @@ -1510,8 +1478,8 @@ eval_op_less (struct type *expect_type, struct expression *exp, { binop_promote (exp->language_defn, exp->gdbarch, &arg1, &arg2); int tem = value_less (arg1, arg2); - struct type *type = language_bool_type (exp->language_defn, - exp->gdbarch); + struct type *type + = language_bool_type (exp->language_defn, exp->gdbarch); return value_from_longest (type, (LONGEST) tem); } } @@ -1520,8 +1488,8 @@ eval_op_less (struct type *expect_type, struct expression *exp, struct value * eval_op_gtr (struct type *expect_type, struct expression *exp, - enum noside noside, enum exp_opcode op, - struct value *arg1, struct value *arg2) + enum noside noside, enum exp_opcode op, struct value *arg1, + struct value *arg2) { if (binop_user_defined_p (op, arg1, arg2)) { @@ -1531,8 +1499,8 @@ eval_op_gtr (struct type *expect_type, struct expression *exp, { binop_promote (exp->language_defn, exp->gdbarch, &arg1, &arg2); int tem = value_less (arg2, arg1); - struct type *type = language_bool_type (exp->language_defn, - exp->gdbarch); + struct type *type + = language_bool_type (exp->language_defn, exp->gdbarch); return value_from_longest (type, (LONGEST) tem); } } @@ -1541,8 +1509,8 @@ eval_op_gtr (struct type *expect_type, struct expression *exp, struct value * eval_op_geq (struct type *expect_type, struct expression *exp, - enum noside noside, enum exp_opcode op, - struct value *arg1, struct value *arg2) + enum noside noside, enum exp_opcode op, struct value *arg1, + struct value *arg2) { if (binop_user_defined_p (op, arg1, arg2)) { @@ -1552,8 +1520,8 @@ eval_op_geq (struct type *expect_type, struct expression *exp, { binop_promote (exp->language_defn, exp->gdbarch, &arg1, &arg2); int tem = value_less (arg2, arg1) || value_equal (arg1, arg2); - struct type *type = language_bool_type (exp->language_defn, - exp->gdbarch); + struct type *type + = language_bool_type (exp->language_defn, exp->gdbarch); return value_from_longest (type, (LONGEST) tem); } } @@ -1562,8 +1530,8 @@ eval_op_geq (struct type *expect_type, struct expression *exp, struct value * eval_op_leq (struct type *expect_type, struct expression *exp, - enum noside noside, enum exp_opcode op, - struct value *arg1, struct value *arg2) + enum noside noside, enum exp_opcode op, struct value *arg1, + struct value *arg2) { if (binop_user_defined_p (op, arg1, arg2)) { @@ -1573,8 +1541,8 @@ eval_op_leq (struct type *expect_type, struct expression *exp, { binop_promote (exp->language_defn, exp->gdbarch, &arg1, &arg2); int tem = value_less (arg1, arg2) || value_equal (arg1, arg2); - struct type *type = language_bool_type (exp->language_defn, - exp->gdbarch); + struct type *type + = language_bool_type (exp->language_defn, exp->gdbarch); return value_from_longest (type, (LONGEST) tem); } } @@ -1583,13 +1551,12 @@ eval_op_leq (struct type *expect_type, struct expression *exp, struct value * eval_op_repeat (struct type *expect_type, struct expression *exp, - enum noside noside, enum exp_opcode op, - struct value *arg1, struct value *arg2) + enum noside noside, enum exp_opcode op, struct value *arg1, + struct value *arg2) { struct type *type = check_typedef (value_type (arg2)); - if (type->code () != TYPE_CODE_INT - && type->code () != TYPE_CODE_ENUM) - error (_("Non-integral right operand for \"@\" operator.")); + if (type->code () != TYPE_CODE_INT && type->code () != TYPE_CODE_ENUM) + error (_ ("Non-integral right operand for \"@\" operator.")); if (noside == EVAL_AVOID_SIDE_EFFECTS) { return allocate_repeat_value (value_type (arg1), @@ -1603,8 +1570,7 @@ eval_op_repeat (struct type *expect_type, struct expression *exp, struct value * eval_op_plus (struct type *expect_type, struct expression *exp, - enum noside noside, enum exp_opcode op, - struct value *arg1) + enum noside noside, enum exp_opcode op, struct value *arg1) { if (unop_user_defined_p (op, arg1)) return value_x_unop (arg1, op, noside); @@ -1619,8 +1585,7 @@ eval_op_plus (struct type *expect_type, struct expression *exp, struct value * eval_op_neg (struct type *expect_type, struct expression *exp, - enum noside noside, enum exp_opcode op, - struct value *arg1) + enum noside noside, enum exp_opcode op, struct value *arg1) { if (unop_user_defined_p (op, arg1)) return value_x_unop (arg1, op, noside); @@ -1635,8 +1600,7 @@ eval_op_neg (struct type *expect_type, struct expression *exp, struct value * eval_op_complement (struct type *expect_type, struct expression *exp, - enum noside noside, enum exp_opcode op, - struct value *arg1) + enum noside noside, enum exp_opcode op, struct value *arg1) { if (unop_user_defined_p (UNOP_COMPLEMENT, arg1)) return value_x_unop (arg1, UNOP_COMPLEMENT, noside); @@ -1651,15 +1615,14 @@ eval_op_complement (struct type *expect_type, struct expression *exp, struct value * eval_op_lognot (struct type *expect_type, struct expression *exp, - enum noside noside, enum exp_opcode op, - struct value *arg1) + enum noside noside, enum exp_opcode op, struct value *arg1) { if (unop_user_defined_p (op, arg1)) return value_x_unop (arg1, op, noside); else { - struct type *type = language_bool_type (exp->language_defn, - exp->gdbarch); + struct type *type + = language_bool_type (exp->language_defn, exp->gdbarch); return value_from_longest (type, (LONGEST) value_logical_not (arg1)); } } @@ -1668,14 +1631,13 @@ eval_op_lognot (struct type *expect_type, struct expression *exp, struct value * eval_op_ind (struct type *expect_type, struct expression *exp, - enum noside noside, - struct value *arg1) + enum noside noside, struct value *arg1) { struct type *type = check_typedef (value_type (arg1)); if (type->code () == TYPE_CODE_METHODPTR || type->code () == TYPE_CODE_MEMBERPTR) - error (_("Attempt to dereference pointer " - "to member without an object")); + error (_ ("Attempt to dereference pointer " + "to member without an object")); if (unop_user_defined_p (UNOP_IND, arg1)) return value_x_unop (arg1, UNOP_IND, noside); else if (noside == EVAL_AVOID_SIDE_EFFECTS) @@ -1693,14 +1655,13 @@ eval_op_ind (struct type *expect_type, struct expression *exp, if (type->is_pointer_or_reference () /* In C you can dereference an array to get the 1st elt. */ || type->code () == TYPE_CODE_ARRAY) - return value_zero (type->target_type (), - lval_memory); + return value_zero (type->target_type (), lval_memory); else if (type->code () == TYPE_CODE_INT) /* GDB allows dereferencing an int. */ return value_zero (builtin_type (exp->gdbarch)->builtin_int, lval_memory); else - error (_("Attempt to take contents of a non-pointer value.")); + error (_ ("Attempt to take contents of a non-pointer value.")); } } @@ -1718,15 +1679,14 @@ eval_op_ind (struct type *expect_type, struct expression *exp, struct value * eval_op_alignof (struct type *expect_type, struct expression *exp, - enum noside noside, - struct value *arg1) + enum noside noside, struct value *arg1) { struct type *type = value_type (arg1); /* FIXME: This should be size_t. */ struct type *size_type = builtin_type (exp->gdbarch)->builtin_int; ULONGEST align = type_align (type); if (align == 0) - error (_("could not determine alignment of type")); + error (_ ("could not determine alignment of type")); return value_from_longest (size_type, align); } @@ -1734,8 +1694,7 @@ eval_op_alignof (struct type *expect_type, struct expression *exp, struct value * eval_op_memval (struct type *expect_type, struct expression *exp, - enum noside noside, - struct value *arg1, struct type *type) + enum noside noside, struct value *arg1, struct type *type) { if (noside == EVAL_AVOID_SIDE_EFFECTS) return value_zero (type, lval_memory); @@ -1747,8 +1706,7 @@ eval_op_memval (struct type *expect_type, struct expression *exp, struct value * eval_op_preinc (struct type *expect_type, struct expression *exp, - enum noside noside, enum exp_opcode op, - struct value *arg1) + enum noside noside, enum exp_opcode op, struct value *arg1) { if (noside == EVAL_AVOID_SIDE_EFFECTS) return arg1; @@ -1778,8 +1736,7 @@ eval_op_preinc (struct type *expect_type, struct expression *exp, struct value * eval_op_predec (struct type *expect_type, struct expression *exp, - enum noside noside, enum exp_opcode op, - struct value *arg1) + enum noside noside, enum exp_opcode op, struct value *arg1) { if (noside == EVAL_AVOID_SIDE_EFFECTS) return arg1; @@ -1809,8 +1766,7 @@ eval_op_predec (struct type *expect_type, struct expression *exp, struct value * eval_op_postinc (struct type *expect_type, struct expression *exp, - enum noside noside, enum exp_opcode op, - struct value *arg1) + enum noside noside, enum exp_opcode op, struct value *arg1) { if (noside == EVAL_AVOID_SIDE_EFFECTS) return arg1; @@ -1843,8 +1799,7 @@ eval_op_postinc (struct type *expect_type, struct expression *exp, struct value * eval_op_postdec (struct type *expect_type, struct expression *exp, - enum noside noside, enum exp_opcode op, - struct value *arg1) + enum noside noside, enum exp_opcode op, struct value *arg1) { if (noside == EVAL_AVOID_SIDE_EFFECTS) return arg1; @@ -1882,7 +1837,7 @@ eval_op_type (struct type *expect_type, struct expression *exp, if (noside == EVAL_AVOID_SIDE_EFFECTS) return allocate_value (type); else - error (_("Attempt to use a type name as an expression")); + error (_ ("Attempt to use a type name as an expression")); } /* A helper function for BINOP_ASSIGN_MODIFY. */ @@ -1896,14 +1851,14 @@ eval_binop_assign_modify (struct type *expect_type, struct expression *exp, return arg1; if (binop_user_defined_p (op, arg1, arg2)) return value_x_binop (arg1, arg2, BINOP_ASSIGN_MODIFY, op, noside); - else if (op == BINOP_ADD && ptrmath_type_p (exp->language_defn, - value_type (arg1)) + else if (op == BINOP_ADD + && ptrmath_type_p (exp->language_defn, value_type (arg1)) && is_integral_type (value_type (arg2))) arg2 = value_ptradd (arg1, value_as_long (arg2)); - else if (op == BINOP_SUB && ptrmath_type_p (exp->language_defn, - value_type (arg1)) + else if (op == BINOP_SUB + && ptrmath_type_p (exp->language_defn, value_type (arg1)) && is_integral_type (value_type (arg2))) - arg2 = value_ptradd (arg1, - value_as_long (arg2)); + arg2 = value_ptradd (arg1, -value_as_long (arg2)); else { struct value *tmp = arg1; @@ -1925,8 +1880,8 @@ eval_binop_assign_modify (struct type *expect_type, struct expression *exp, null pointer. */ static struct value * eval_op_objc_msgcall (struct type *expect_type, struct expression *exp, - enum noside noside, CORE_ADDR selector, - value *target, gdb::array_view<value *> args) + enum noside noside, CORE_ADDR selector, value *target, + gdb::array_view<value *> args) { CORE_ADDR responds_selector = 0; CORE_ADDR method_selector = 0; @@ -1976,19 +1931,17 @@ eval_op_objc_msgcall (struct type *expect_type, struct expression *exp, type = lookup_pointer_type (type); msg_send = find_function_in_inferior ("objc_msg_lookup", NULL); - msg_send_stret - = find_function_in_inferior ("objc_msg_lookup", NULL); + msg_send_stret = find_function_in_inferior ("objc_msg_lookup", NULL); msg_send = value_from_pointer (type, value_as_address (msg_send)); - msg_send_stret = value_from_pointer (type, - value_as_address (msg_send_stret)); + msg_send_stret + = value_from_pointer (type, value_as_address (msg_send_stret)); } else { msg_send = find_function_in_inferior ("objc_msgSend", NULL); /* Special dispatcher for methods returning structs. */ - msg_send_stret - = find_function_in_inferior ("objc_msgSend_stret", NULL); + msg_send_stret = find_function_in_inferior ("objc_msgSend_stret", NULL); } /* Verify the target object responds to this method. The @@ -1999,20 +1952,17 @@ eval_op_objc_msgcall (struct type *expect_type, struct expression *exp, responds_selector = lookup_child_selector (exp->gdbarch, "respondsToSelector:"); if (responds_selector == 0) - responds_selector - = lookup_child_selector (exp->gdbarch, "respondsTo:"); + responds_selector = lookup_child_selector (exp->gdbarch, "respondsTo:"); if (responds_selector == 0) - error (_("no 'respondsTo:' or 'respondsToSelector:' method")); + error (_ ("no 'respondsTo:' or 'respondsToSelector:' method")); - method_selector - = lookup_child_selector (exp->gdbarch, "methodForSelector:"); + method_selector = lookup_child_selector (exp->gdbarch, "methodForSelector:"); if (method_selector == 0) - method_selector - = lookup_child_selector (exp->gdbarch, "methodFor:"); + method_selector = lookup_child_selector (exp->gdbarch, "methodFor:"); if (method_selector == 0) - error (_("no 'methodFor:' or 'methodForSelector:' method")); + error (_ ("no 'methodFor:' or 'methodForSelector:' method")); /* Call the verification method, to make sure that the target class implements the desired method. */ @@ -2023,15 +1973,15 @@ eval_op_objc_msgcall (struct type *expect_type, struct expression *exp, argvec[3] = value_from_longest (long_type, selector); argvec[4] = 0; - ret = call_function_by_hand (argvec[0], NULL, {argvec + 1, 3}); + ret = call_function_by_hand (argvec[0], NULL, { argvec + 1, 3 }); if (gnu_runtime) { /* Function objc_msg_lookup returns a pointer. */ argvec[0] = ret; - ret = call_function_by_hand (argvec[0], NULL, {argvec + 1, 3}); + ret = call_function_by_hand (argvec[0], NULL, { argvec + 1, 3 }); } if (value_as_long (ret) == 0) - error (_("Target does not respond to this message selector.")); + error (_ ("Target does not respond to this message selector.")); /* Call "methodForSelector:" method, to get the address of a function method that implements this selector for this @@ -2045,11 +1995,11 @@ eval_op_objc_msgcall (struct type *expect_type, struct expression *exp, argvec[3] = value_from_longest (long_type, selector); argvec[4] = 0; - ret = call_function_by_hand (argvec[0], NULL, {argvec + 1, 3}); + ret = call_function_by_hand (argvec[0], NULL, { argvec + 1, 3 }); if (gnu_runtime) { argvec[0] = ret; - ret = call_function_by_hand (argvec[0], NULL, {argvec + 1, 3}); + ret = call_function_by_hand (argvec[0], NULL, { argvec + 1, 3 }); } /* ret should now be the selector. */ @@ -2061,8 +2011,8 @@ eval_op_objc_msgcall (struct type *expect_type, struct expression *exp, /* The address might point to a function descriptor; resolve it to the actual code address instead. */ - addr = gdbarch_convert_from_func_ptr_addr - (exp->gdbarch, addr, current_inferior ()->top_target ()); + addr = gdbarch_convert_from_func_ptr_addr ( + exp->gdbarch, addr, current_inferior ()->top_target ()); /* Is it a high_level symbol? */ sym = find_pc_function (addr); @@ -2084,15 +2034,13 @@ eval_op_objc_msgcall (struct type *expect_type, struct expression *exp, val_type = check_typedef (val_type); - if ((val_type == NULL) - || (val_type->code () == TYPE_CODE_ERROR)) + if ((val_type == NULL) || (val_type->code () == TYPE_CODE_ERROR)) { if (expect_type != NULL) val_type = expect_type; } - struct_return = using_struct_return (exp->gdbarch, method, - val_type); + struct_return = using_struct_return (exp->gdbarch, method, val_type); } else if (expect_type != NULL) { @@ -2116,8 +2064,8 @@ eval_op_objc_msgcall (struct type *expect_type, struct expression *exp, if (method) { if (value_type (method)->code () != TYPE_CODE_FUNC) - error (_("method address has symbol information " - "with non-function type; skipping")); + error (_ ("method address has symbol information " + "with non-function type; skipping")); /* Create a function pointer of the appropriate type, and replace its value with the value of msg_send or @@ -2142,7 +2090,6 @@ eval_op_objc_msgcall (struct type *expect_type, struct expression *exp, called_method = msg_send; } - if (noside == EVAL_AVOID_SIDE_EFFECTS) { /* If the return type doesn't look like a function type, @@ -2167,8 +2114,8 @@ eval_op_objc_msgcall (struct type *expect_type, struct expression *exp, return allocate_value (callee_type); } else - error (_("Expression of type other than " - "\"method returning ...\" used as a method")); + error (_ ("Expression of type other than " + "\"method returning ...\" used as a method")); } /* Now depending on whether we found a symbol for the method, @@ -2218,10 +2165,10 @@ eval_multi_subscript (struct type *expect_type, struct expression *exp, default: if (type->name ()) - error (_("cannot subscript something of type `%s'"), + error (_ ("cannot subscript something of type `%s'"), type->name ()); else - error (_("cannot subscript requested type")); + error (_ ("cannot subscript requested type")); } } } @@ -2233,8 +2180,7 @@ namespace expr value * objc_msgcall_operation::evaluate (struct type *expect_type, - struct expression *exp, - enum noside noside) + struct expression *exp, enum noside noside) { enum noside sub_no_side = EVAL_NORMAL; struct type *selector_type = builtin_type (exp->gdbarch)->builtin_data_ptr; @@ -2258,8 +2204,8 @@ objc_msgcall_operation::evaluate (struct type *expect_type, argvec[i + 2] = args[i]->evaluate_with_coercion (exp, sub_no_side); argvec[args.size () + 2] = nullptr; - return eval_op_objc_msgcall (expect_type, exp, noside, std:: - get<0> (m_storage), target, + return eval_op_objc_msgcall (expect_type, exp, noside, + std::get<0> (m_storage), target, gdb::make_array_view (argvec, args.size () + 3)); } @@ -2280,8 +2226,7 @@ multi_subscript_operation::evaluate (struct type *expect_type, value * logical_and_operation::evaluate (struct type *expect_type, - struct expression *exp, - enum noside noside) + struct expression *exp, enum noside noside) { value *arg1 = std::get<0> (m_storage)->evaluate (nullptr, exp, noside); @@ -2301,16 +2246,15 @@ logical_and_operation::evaluate (struct type *expect_type, arg2 = std::get<1> (m_storage)->evaluate (nullptr, exp, noside); tem = value_logical_not (arg2); } - struct type *type = language_bool_type (exp->language_defn, - exp->gdbarch); + struct type *type + = language_bool_type (exp->language_defn, exp->gdbarch); return value_from_longest (type, !tem); } } value * logical_or_operation::evaluate (struct type *expect_type, - struct expression *exp, - enum noside noside) + struct expression *exp, enum noside noside) { value *arg1 = std::get<0> (m_storage)->evaluate (nullptr, exp, noside); @@ -2331,15 +2275,14 @@ logical_or_operation::evaluate (struct type *expect_type, tem = value_logical_not (arg2); } - struct type *type = language_bool_type (exp->language_defn, - exp->gdbarch); + struct type *type + = language_bool_type (exp->language_defn, exp->gdbarch); return value_from_longest (type, !tem); } } value * -adl_func_operation::evaluate (struct type *expect_type, - struct expression *exp, +adl_func_operation::evaluate (struct type *expect_type, struct expression *exp, enum noside noside) { std::vector<operation_up> &arg_ops = std::get<2> (m_storage); @@ -2348,16 +2291,13 @@ adl_func_operation::evaluate (struct type *expect_type, args[i] = arg_ops[i]->evaluate_with_coercion (exp, noside); struct symbol *symp; - find_overload_match (args, std::get<0> (m_storage).c_str (), - NON_METHOD, - nullptr, nullptr, - nullptr, &symp, nullptr, 0, noside); + find_overload_match (args, std::get<0> (m_storage).c_str (), NON_METHOD, + nullptr, nullptr, nullptr, &symp, nullptr, 0, noside); if (symp->type ()->code () == TYPE_CODE_ERROR) error_unknown_type (symp->print_name ()); value *callee = evaluate_var_value (noside, std::get<1> (m_storage), symp); - return evaluate_subexp_do_call (exp, noside, callee, args, - nullptr, expect_type); - + return evaluate_subexp_do_call (exp, noside, callee, args, nullptr, + expect_type); } /* This function evaluates brace-initializers (in C/C++) for @@ -2386,11 +2326,11 @@ array_operation::evaluate_struct_tuple (struct value *struct_val, && field_is_static (&struct_type->field (fieldno))) fieldno++; if (fieldno >= struct_type->num_fields ()) - error (_("too many initializers")); + error (_ ("too many initializers")); field_type = struct_type->field (fieldno).type (); if (field_type->code () == TYPE_CODE_UNION && struct_type->field (fieldno).name ()[0] == '0') - error (_("don't know which variant you want to set")); + error (_ ("don't know which variant you want to set")); /* Here, struct_type is the type of the inner struct, while substruct_type is the type of the inner struct. @@ -2415,19 +2355,17 @@ array_operation::evaluate_struct_tuple (struct value *struct_val, bitpos = struct_type->field (fieldno).loc_bitpos (); addr = value_contents_writeable (struct_val).data () + bitpos / 8; if (bitsize) - modify_field (struct_type, addr, - value_as_long (val), bitpos % 8, bitsize); + modify_field (struct_type, addr, value_as_long (val), bitpos % 8, + bitsize); else memcpy (addr, value_contents (val).data (), value_type (val)->length ()); - } return struct_val; } value * -array_operation::evaluate (struct type *expect_type, - struct expression *exp, +array_operation::evaluate (struct type *expect_type, struct expression *exp, enum noside noside) { int tem; @@ -2437,8 +2375,7 @@ array_operation::evaluate (struct type *expect_type, int nargs = tem3 - tem2 + 1; struct type *type = expect_type ? check_typedef (expect_type) : nullptr; - if (expect_type != nullptr - && type->code () == TYPE_CODE_STRUCT) + if (expect_type != nullptr && type->code () == TYPE_CODE_STRUCT) { struct value *rec = allocate_value (expect_type); @@ -2446,8 +2383,7 @@ array_operation::evaluate (struct type *expect_type, return evaluate_struct_tuple (rec, exp, noside, nargs); } - if (expect_type != nullptr - && type->code () == TYPE_CODE_ARRAY) + if (expect_type != nullptr && type->code () == TYPE_CODE_ARRAY) { struct type *range_type = type->index_type (); struct type *element_type = type->target_type (); @@ -2466,24 +2402,22 @@ array_operation::evaluate (struct type *expect_type, { struct value *element; - element = in_args[index - low_bound]->evaluate (element_type, - exp, noside); + element + = in_args[index - low_bound]->evaluate (element_type, exp, noside); if (value_type (element) != element_type) element = value_cast (element_type, element); if (index > high_bound) /* To avoid memory corruption. */ - error (_("Too many array elements")); + error (_ ("Too many array elements")); memcpy (value_contents_raw (array).data () - + (index - low_bound) * element_size, - value_contents (element).data (), - element_size); + + (index - low_bound) * element_size, + value_contents (element).data (), element_size); index++; } return array; } - if (expect_type != nullptr - && type->code () == TYPE_CODE_SET) + if (expect_type != nullptr && type->code () == TYPE_CODE_SET) { struct value *set = allocate_value (expect_type); gdb_byte *valaddr = value_contents_raw (set).data (); @@ -2497,7 +2431,7 @@ array_operation::evaluate (struct type *expect_type, check_type = check_type->target_type (); if (!get_discrete_bounds (element_type, &low_bound, &high_bound)) - error (_("(power)set type with unknown size")); + error (_ ("(power)set type with unknown size")); memset (valaddr, '\0', type->length ()); int idx = 0; for (tem = 0; tem < nargs; tem++) @@ -2521,18 +2455,18 @@ array_operation::evaluate (struct type *expect_type, || (range_low_type->code () == TYPE_CODE_ENUM && (range_low_type != range_high_type))) /* different element modes. */ - error (_("POWERSET tuple elements of different mode")); + error (_ ("POWERSET tuple elements of different mode")); if ((check_type->code () != range_low_type->code ()) || (check_type->code () == TYPE_CODE_ENUM && range_low_type != check_type)) - error (_("incompatible POWERSET tuple elements")); + error (_ ("incompatible POWERSET tuple elements")); if (range_low > range_high) { - warning (_("empty POWERSET tuple range")); + warning (_ ("empty POWERSET tuple range")); continue; } if (range_low < low_bound || range_high > high_bound) - error (_("POWERSET tuple element out of range")); + error (_ ("POWERSET tuple element out of range")); range_low -= low_bound; range_high -= low_bound; for (; range_low <= range_high; range_low++) @@ -2541,8 +2475,8 @@ array_operation::evaluate (struct type *expect_type, if (gdbarch_byte_order (exp->gdbarch) == BFD_ENDIAN_BIG) bit_index = TARGET_CHAR_BIT - 1 - bit_index; - valaddr[(unsigned) range_low / TARGET_CHAR_BIT] - |= 1 << bit_index; + valaddr[(unsigned) range_low / TARGET_CHAR_BIT] |= 1 + << bit_index; } } return set; @@ -2560,23 +2494,21 @@ array_operation::evaluate (struct type *expect_type, value * unop_extract_operation::evaluate (struct type *expect_type, - struct expression *exp, - enum noside noside) + 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 () > value_type (old_value)->length ()) - error (_("length type is larger than the value type")); + 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 ()); return result; } -} +} // namespace expr - /* Helper for evaluate_subexp_for_address. */ static value * @@ -2590,12 +2522,12 @@ evaluate_subexp_for_address_base (struct expression *exp, enum noside noside, if (TYPE_IS_REFERENCE (type)) return value_zero (lookup_pointer_type (type->target_type ()), not_lval); - else if (VALUE_LVAL (x) == lval_memory || value_must_coerce_to_target (x)) - return value_zero (lookup_pointer_type (value_type (x)), - not_lval); + else if (VALUE_LVAL (x) == lval_memory + || value_must_coerce_to_target (x)) + return value_zero (lookup_pointer_type (value_type (x)), not_lval); else - error (_("Attempt to take address of " - "value not located in memory.")); + error (_ ("Attempt to take address of " + "value not located in memory.")); } return value_addr (x); } @@ -2604,8 +2536,7 @@ namespace expr { value * -operation::evaluate_for_cast (struct type *expect_type, - struct expression *exp, +operation::evaluate_for_cast (struct type *expect_type, struct expression *exp, enum noside noside) { value *val = evaluate (expect_type, exp, noside); @@ -2623,11 +2554,11 @@ value * scope_operation::evaluate_for_address (struct expression *exp, enum noside noside) { - value *x = value_aggregate_elt (std::get<0> (m_storage), - std::get<1> (m_storage).c_str (), - NULL, 1, noside); + value *x + = value_aggregate_elt (std::get<0> (m_storage), + std::get<1> (m_storage).c_str (), NULL, 1, noside); if (x == NULL) - error (_("There is no field named %s"), std::get<1> (m_storage).c_str ()); + error (_ ("There is no field named %s"), std::get<1> (m_storage).c_str ()); return x; } @@ -2697,10 +2628,9 @@ var_value_operation::evaluate_for_address (struct expression *exp, struct type *type = lookup_pointer_type (var->type ()); enum address_class sym_class = var->aclass (); - if (sym_class == LOC_CONST - || sym_class == LOC_CONST_BYTES + if (sym_class == LOC_CONST || sym_class == LOC_CONST_BYTES || sym_class == LOC_REGISTER) - error (_("Attempt to take address of register or constant.")); + error (_ ("Attempt to take address of register or constant.")); return value_zero (type, not_lval); } @@ -2714,18 +2644,17 @@ var_value_operation::evaluate_with_coercion (struct expression *exp, { struct symbol *var = std::get<0> (m_storage).symbol; struct type *type = check_typedef (var->type ()); - if (type->code () == TYPE_CODE_ARRAY - && !type->is_vector () + if (type->code () == TYPE_CODE_ARRAY && !type->is_vector () && CAST_IS_CONVERSION (exp->language_defn)) { - struct value *val = address_of_variable (var, - std::get<0> (m_storage).block); + struct value *val + = address_of_variable (var, std::get<0> (m_storage).block); return value_cast (lookup_pointer_type (type->target_type ()), val); } return evaluate (nullptr, exp, noside); } -} +} // namespace expr /* Helper function for evaluating the size of a type. */ @@ -2794,8 +2723,8 @@ subscript_operation::evaluate_for_sizeof (struct expression *exp, /* FIXME: This should be size_t. */ struct type *size_type = builtin_type (exp->gdbarch)->builtin_int; - return value_from_longest - (size_type, (LONGEST) value_type (val)->length ()); + return value_from_longest ( + size_type, (LONGEST) value_type (val)->length ()); } } } @@ -2811,9 +2740,8 @@ unop_ind_base_operation::evaluate_for_sizeof (struct expression *exp, value *val = std::get<0> (m_storage)->evaluate (nullptr, exp, EVAL_AVOID_SIDE_EFFECTS); struct type *type = check_typedef (value_type (val)); - if (!type->is_pointer_or_reference () - && type->code () != TYPE_CODE_ARRAY) - error (_("Attempt to take contents of a non-pointer value.")); + if (!type->is_pointer_or_reference () && type->code () != TYPE_CODE_ARRAY) + error (_ ("Attempt to take contents of a non-pointer value.")); type = type->target_type (); if (is_dynamic_type (type)) type = value_type (value_ind (val)); @@ -2889,8 +2817,7 @@ var_value_operation::evaluate_for_cast (struct type *to_type, struct expression *exp, enum noside noside) { - value *val = evaluate_var_value (noside, - std::get<0> (m_storage).block, + value *val = evaluate_var_value (noside, std::get<0> (m_storage).block, std::get<0> (m_storage).symbol); val = value_cast (to_type, val); @@ -2905,7 +2832,7 @@ var_value_operation::evaluate_for_cast (struct type *to_type, return val; } -} +} // namespace expr /* Parse a type expression in the string [P..P+LENGTH). */ @@ -2923,6 +2850,6 @@ parse_and_eval_type (const char *p, int length) expr::unop_cast_operation *op = dynamic_cast<expr::unop_cast_operation *> (expr->op.get ()); if (op == nullptr) - error (_("Internal error in eval_type.")); + error (_ ("Internal error in eval_type.")); return op->get_type (); } |