This is originally implemented by Jacques Pienaar.
Details
Diff Detail
- Repository
- rL LLVM
Event Timeline
Nice! See a few comments inline.
| clang-tidy/misc/IncorrectRoundings.cpp | ||
|---|---|---|
| 38 ↗ | (On Diff #46515) | We should use a more effective way of checking whether the type is a (long)? double or float. There'a builtinType() matcher that we could extend with a narrowing matcher calling BuiltinType::isFloatingPoint() (that can be added to ASTMatchers.h, I think). | 
| 50 ↗ | (On Diff #46515) | Since these two .bind() calls are in alternative branches, they can use the same identifier. This would also simplify the code in the callback. | 
| 71 ↗ | (On Diff #46515) | I don't think we should recommend lrint, since its behavior can be changed by fesetround(). lround() and llround() are better alternatives, IMO. We could also suggest an automated fix for this. | 
| clang-tidy/misc/IncorrectRoundings.cpp | ||
|---|---|---|
| 39 ↗ | (On Diff #46539) | Done. The ASTMatchers.h file is not in clang-tidy repository, so I temporarily implement isFloatingPoint narrowing matcher here. Will create a separated patch to clang repository. | 
| 51 ↗ | (On Diff #46539) | Just found out there is no need to bind here since check function doesn't use it. Have removed it. |