[PATCH] D31097: [clang-tidy] don't warn about implicit widening casts in function calls

Daniel Marjamäki via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Fri Mar 17 13:31:59 PDT 2017

danielmarjamaki added a comment.

In my opinion, we should stop warning about all implicit casts.

Take for instance:

  long l1;
  if (condition)
    l1 = n << 8;  // <- implicit cast
    l1 = ~0L;

That is fine. Nothing suspicious. Just because the destination variable is long doesn't have to mean the result is long. If we want to warn I would say that valueflow analysis should be used to see if there is truncation.

The original idea was that we would warn if the user tried to cast the result but did that wrong. I don't feel that this is the idea of this checker anymore.



More information about the cfe-commits mailing list