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
43 lines
904 B
ReStructuredText
43 lines
904 B
ReStructuredText
.. title:: clang-tidy - llvm-redundant-casting
|
|
|
|
llvm-redundant-casting
|
|
======================
|
|
|
|
Points out uses of ``cast<>``, ``dyn_cast<>``, ``isa<>`` and their ``or_null``
|
|
variants that are unnecessary because the argument already is of the target
|
|
type, or a derived type thereof.
|
|
|
|
.. code-block:: c++
|
|
|
|
struct A {};
|
|
A a;
|
|
// Finds:
|
|
A x = cast<A>(a);
|
|
// replaced by:
|
|
A x = a;
|
|
|
|
struct B : public A {};
|
|
B b;
|
|
// Finds:
|
|
A y = cast<A>(b);
|
|
// replaced by:
|
|
A y = b;
|
|
|
|
struct C : public A {};
|
|
C c;
|
|
// Finds:
|
|
bool r1 = isa<A>(a) // always true
|
|
bool r2 = isa<A>(b) // always true
|
|
bool r3 = isa<B, C>(c) // always true
|
|
|
|
Supported functions:
|
|
- ``llvm::cast``
|
|
- ``llvm::cast_or_null``
|
|
- ``llvm::cast_if_present``
|
|
- ``llvm::dyn_cast``
|
|
- ``llvm::dyn_cast_or_null``
|
|
- ``llvm::dyn_cast_if_present``
|
|
- ``llvm::isa``
|
|
- ``llvm::isa_and_nonnull``
|
|
- ``llvm::isa_and_present``
|