[C++ PATCH] Improve location info [1/many]
Jason Merrill
jason@redhat.com
Mon Aug 11 17:25:00 GMT 2014
On 08/01/2014 07:59 AM, Marek Polacek wrote:
Thanks for taking this on, sorry it's taken so long to respond.
> +convert_like_real (location_t loc, conversion *convs, tree expr, tree fn,
> + int argnum, int inner, bool issue_conversion_warnings,
> bool c_cast_p, tsubst_flags_t complain)
> {
> tree totype = convs->type;
> diagnostic_t diag_kind;
> int flags;
> - location_t loc = EXPR_LOC_OR_LOC (expr, input_location);
I'm afraid I think this will be a regression for many callers: for
instance, with a ?: expression this will change conversion diagnostics
to have the same location as the ?: as a whole rather than the location
of the subexpression being converted. Same for build_new_op_1, and all
the calls where now you pass input_location.
Furthermore, the arguments should have their own locations in
EXPR_LOCATION; I don't think we need to track them separately. If their
locations are wrong that's something to fix directly, rather than adding
a special case for function arguments.
So I think I'd like to drop the arg_loc/convert_like changes from this
patch.
> + pedwarn (loc, 0, "deducing %qT as %qT",
> + if (permerror (loc, "passing %qT as %<this%> "
These should use the location of the argument, not the call.
There are also a lot of added uses of input_location, which makes me
uncomfortable. For build_operator_new_call and build_new_1, I think we
want the location of the 'new' token. For build_op_call_1, we can use
the '(', and so on.
Jason
More information about the Gcc-patches
mailing list