Eugene.Zelenko added inline comments.
Comment at: clang-tidy/abseil/DurationFactoryFloatCheck.cpp:24
+// Returns an integer if the fractional part of a `FloatingLiteral` is 0.
+llvm::Optional
+TruncateIfIntegral(const FloatingLiteral &FloatLiteral) {
Please use s
alexfh added a comment.
LG In general, but see a few comments inline.
Comment at: clang-tidy/abseil/DurationFactoryFloatCheck.cpp:25
+llvm::Optional
+TruncateIfIntegral(const FloatingLiteral &FloatLiteral) {
+ double value = FloatLiteral.getValueAsApproximateDouble();
hwright created this revision.
hwright added reviewers: alexfh, alexfh_.
Herald added a subscriber: mgorny.
This check finds cases where calls to an absl::Duration factory could use the
more efficient integer overload.
For example:
// Original - Providing a floating-point literal.
absl::Duration