[PATCH] D42728: Add more warnings for implict conversions (e.g. double truncation to float).

John McCall via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Feb 13 12:24:18 PST 2018

rjmccall added a comment.

In https://reviews.llvm.org/D42728#1006260, @avt77 wrote:

> I removed the ambiguity with changes in CheckImplicitConversion (required by rksimon): now it's absolutely clear what was changed.
>  And I minimized changes in diagnostics(required by rjmccall): the only float-double truncation was changed. As result only two tests were changed. Later we could easily extend the diagnostic updates if it will be necessary (but inside another patch).

Hmm.  I'm still torn about this.  I feel like at a minimum it's necessary to explain in the diagnostic that the conversion is the final conversion does as part of a compound assignment.  I think the right solution is to tell CheckImplicitConversion that it's not just a straight-up conversion, it's a conversion done as part of a compound assignment, and then CheckImplicitConversion can choose to suppress or use different diagnostics based on that information.  This will also more reliably avoid duplicate diagnostics.


More information about the llvm-commits mailing list