brintos

brintos / llvm-project-archived public Read only

0
0
Text · 863 B · a4fc6d4 Raw
30 lines · plain
1.. title:: clang-tidy - abseil-duration-factory-float2 3abseil-duration-factory-float4=============================5 6Checks for cases where the floating-point overloads of various7``absl::Duration`` factory functions are called when the more-efficient8integer versions could be used instead.9 10This check will not suggest fixes for literals which contain fractional11floating point values or non-literals. It will suggest removing12superfluous casts.13 14Examples:15 16.. code-block:: c++17 18  // Original - Providing a floating-point literal.19  absl::Duration d = absl::Seconds(10.0);20 21  // Suggested - Use an integer instead.22  absl::Duration d = absl::Seconds(10);23 24 25  // Original - Explicitly casting to a floating-point type.26  absl::Duration d = absl::Seconds(static_cast<double>(10));27 28  // Suggested - Remove the explicit cast29  absl::Duration d = absl::Seconds(10);30