brintos

brintos / llvm-project-archived public Read only

0
0
Text · 934 B · cba5202 Raw
36 lines · plain
1.. title:: clang-tidy - abseil-duration-factory-scale2 3abseil-duration-factory-scale4=============================5 6Checks for cases where arguments to ``absl::Duration`` factory functions are7scaled internally and could be changed to a different factory function. This8check also looks for arguments with a zero value and suggests using9``absl::ZeroDuration()`` instead.10 11Examples:12 13.. code-block:: c++14 15  // Original - Internal multiplication.16  int x;17  absl::Duration d = absl::Seconds(60 * x);18 19  // Suggested - Use absl::Minutes instead.20  absl::Duration d = absl::Minutes(x);21 22 23  // Original - Internal division.24  int y;25  absl::Duration d = absl::Milliseconds(y / 1000.);26 27  // Suggested - Use absl:::Seconds instead.28  absl::Duration d = absl::Seconds(y);29 30 31  // Original - Zero-value argument.32  absl::Duration d = absl::Hours(0);33 34  // Suggested = Use absl::ZeroDuration instead35  absl::Duration d = absl::ZeroDuration();36