[PATCH] [clang-tidy] Add a checker for swapped literal arguments.

David Blaikie dblaikie at gmail.com
Thu Jul 10 08:35:56 PDT 2014


Worth a compiler warning?

If we're talking literals, could we just warn whenever someone wrote a
literal with a mismatched parameter? (3.0 for an int parameter -
skipping 3e6 as being safe because people like to write big ints with
exponent notation even though it's actually a double)

Things like passing literal true/false for int parameters is also
often a bad sign... (I tried to implement bool literal conversion at
some point, but never got around to finishing it - it caught some
cases like this)

http://reviews.llvm.org/D4457






More information about the cfe-commits mailing list