[PATCH] D53339: Add the abseil-duration-factory-float clang-tidy check

2018-10-16 Thread Eugene Zelenko via Phabricator via cfe-commits
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

[PATCH] D53339: Add the abseil-duration-factory-float clang-tidy check

2018-10-16 Thread Alexander Kornienko via Phabricator via cfe-commits
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();

[PATCH] D53339: Add the abseil-duration-factory-float clang-tidy check

2018-10-16 Thread Hyrum Wright via Phabricator via cfe-commits
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