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

Andrew V. Tischenko via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Feb 22 03:43:22 PST 2018


avt77 added a comment.

> 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.

I'm not sure I understand you. There is a special branch in CheckImplicitConversion related to FloatingPoint:

  if (SourceBT && SourceBT->isFloatingPoint()) {
    // ...and the target is floating point...
    if (TargetBT && TargetBT->isFloatingPoint()) {
      // ...then warn if we're dropping FP rank.

And that's exactly our case. How can knowledge about "part of a compound assignment" improve the diagnostic here? Please, clarify.


https://reviews.llvm.org/D42728





More information about the llvm-commits mailing list