This is the mail archive of the mailing list for the GDB project.

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [RFA] Add method overload resolution to expression parser

>>>>> "Keith" == Keith Seitz <> writes:

Keith> I've attached an updated patch which I think addresses most of the
Keith> serious concerns.


Keith> +exp     :       exp '(' nonempty_typelist ')' const_or_volatile
Keith> +			{ int i;
Keith> +			  write_exp_elt_opcode (TYPE_INSTANCE);
Keith> +			  write_exp_elt_longcst ((LONGEST) $<ivec>3[0]);
Keith> +			  for (i = 0; i < $<ivec>3[0]; ++i)
Keith> +			    write_exp_elt_type ($<tvec>3[i + 1]);
Keith> +			  write_exp_elt_longcst((LONGEST) $<ivec>3[0]);

This is ok, because c-exp.y already does this, but the ivec/tvec
overloading still seems weird to me.

Keith> +    case TYPE_INSTANCE:
Keith> +      nargs = longest_to_int (exp->elts[pc + 1].longconst);
Keith> +      arg_types = (struct type **) alloca (nargs * sizeof (struct type *));
Keith> +      for (ix = 0; ix < nargs; ++ix)
Keith> +	arg_types[ix] = exp->elts[pc + 1 + ix + 1].type;
Keith> +
Keith> +      expect_type = make_params (nargs, arg_types);
Keith> +      *(pos) += 3 + nargs;
Keith> +      arg1 = evaluate_subexp_standard (expect_type, exp, pos, noside);
Keith> +      xfree (TYPE_FIELDS (expect_type));
Keith> +      xfree (TYPE_MAIN_TYPE (expect_type));
Keith> +      xfree (expect_type);

These frees should be done with cleanups, in case
evaluate_subexp_standard throws an exception.
I think free_param_types was ok, it was just that the cleanup was made in
a surprising place (make_params) and not run at the "right point" (just
before the end of the TYPE_INSTANCE case).

This is ok with that change.  Thanks.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]