CodeQL / Analyze (actions) (push) Canceled after 0s
CodeQL / Analyze (python) (push) Canceled after 0s
pre-commit / pre-commit (push) Canceled after 0s
Multi-Arch CI / setup (push) Canceled after 0s
Publish build_manylinux_x86_64 images / publish_build_manylinux_x86_64 (push) Canceled after 0s
Setup (Multi-Arch) / setup (push) Canceled after 0s
Multi-Arch CI / Linux::${{ fromJSON(needs.setup.outputs.linux_build_config || '{}').build_variant_label || 'skip' }} (push) Canceled after 0s
Publish TheRock Docker image / build-and-push-image (push) Canceled after 0s
Publish no_rocm_image_ubi10 image / publish_no_rocm_image_ubi10 (push) Canceled after 0s
Multi-Arch CI / Windows::${{ fromJSON(needs.setup.outputs.windows_build_config || '{}').build_variant_label || 'skip' }} (push) Canceled after 0s
Publish TheRock Docker image / build-and-push-image (push) Canceled after 0s
Multi-Arch CI / Manifest Diff (push) Canceled after 0s
TheRock Manifest Diff Report / Generate Manifest Diff Report (push) Canceled after 0s
Multi-Arch CI / CI Summary (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04 images / publish_no_rocm_image_ubuntu24_04 (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04_ocl_rt images / publish_no_rocm_image_ubuntu24_04_ocl_rt (push) Canceled after 0s
Publish TheRock Docker image / build-and-push-image (push) Canceled after 0s
Publish TheRock Docker image / build-and-push-image (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04 images / publish_no_rocm_image_ubuntu24_04_rocgdb (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04_rocgdb images / publish_no_rocm_image_ubuntu24_04_rocgdb (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04 images / publish_no_rocm_image_ubuntu24_04_ocl_rt (push) Canceled after 0s
Publish TheRock Docker image / build-and-push-image (push) Canceled after 0s
Unit Tests / Unit Tests :: ubuntu-24.04 (push) Canceled after 0s
Unit Tests / Unit Tests :: windows-2022 (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04 images / publish_no_rocm_image_ubuntu24_04_media (push) Canceled after 0s
Unit Tests / Unit Tests Summary (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04 images / publish_no_rocm_image_ubuntu24_04_openmpi (push) Canceled after 0s
37 lines
1.3 KiB
ReStructuredText
37 lines
1.3 KiB
ReStructuredText
.. title:: clang-tidy - abseil-duration-subtraction
|
|
|
|
abseil-duration-subtraction
|
|
===========================
|
|
|
|
Checks for cases where subtraction should be performed in the
|
|
``absl::Duration`` domain. When subtracting two values, and the first one is
|
|
known to be a conversion from ``absl::Duration``, we can infer that the second
|
|
should also be interpreted as an ``absl::Duration``, and make that inference
|
|
explicit.
|
|
|
|
Examples:
|
|
|
|
.. code-block:: c++
|
|
|
|
// Original - Subtraction in the double domain
|
|
double x;
|
|
absl::Duration d;
|
|
double result = absl::ToDoubleSeconds(d) - x;
|
|
|
|
// Suggestion - Subtraction in the absl::Duration domain instead
|
|
double result = absl::ToDoubleSeconds(d - absl::Seconds(x));
|
|
|
|
// Original - Subtraction of two Durations in the double domain
|
|
absl::Duration d1, d2;
|
|
double result = absl::ToDoubleSeconds(d1) - absl::ToDoubleSeconds(d2);
|
|
|
|
// Suggestion - Subtraction in the absl::Duration domain instead
|
|
double result = absl::ToDoubleSeconds(d1 - d2);
|
|
|
|
|
|
Note: As with other ``clang-tidy`` checks, it is possible that multiple fixes
|
|
may overlap (as in the case of nested expressions), so not all occurrences can
|
|
be transformed in one run. In particular, this may occur for nested subtraction
|
|
expressions. Running ``clang-tidy`` multiple times will find and fix these
|
|
overlaps.
|