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
53 lines
2.2 KiB
ReStructuredText
53 lines
2.2 KiB
ReStructuredText
.. title:: clang-tidy - misc-throw-by-value-catch-by-reference
|
|
|
|
misc-throw-by-value-catch-by-reference
|
|
======================================
|
|
|
|
`cert-err09-cpp` and `cert-err61-cpp` redirect here as aliases of this check.
|
|
|
|
Finds violations of the rule "Throw by value, catch by reference" presented for
|
|
example in "C++ Coding Standards" by H. Sutter and A. Alexandrescu, as well as
|
|
the CERT C++ Coding Standard rule `ERR61-CPP. Catch exceptions by lvalue
|
|
reference <https://wiki.sei.cmu.edu/confluence/display/cplusplus/ERR61-CPP.+Catch+exceptions+by+lvalue+reference>`_.
|
|
|
|
|
|
Exceptions:
|
|
* Throwing string literals will not be flagged despite being a pointer. They
|
|
are not susceptible to slicing and the usage of string literals is
|
|
idiomatic.
|
|
* Catching character pointers (``char``, ``wchar_t``, unicode character
|
|
types) will not be flagged to allow catching string literals.
|
|
* Moved named values will not be flagged as not throwing an anonymous
|
|
temporary. In this case we can be sure that the user knows that the object
|
|
can't be accessed outside catch blocks handling the error.
|
|
* Throwing function parameters will not be flagged as not throwing an
|
|
anonymous temporary. This allows helper functions for throwing.
|
|
* Re-throwing caught exception variables will not be flagged as not throwing
|
|
an anonymous temporary. Although this can usually be done by just writing
|
|
``throw;`` it happens often enough in real code.
|
|
|
|
Options
|
|
-------
|
|
|
|
.. option:: CheckThrowTemporaries
|
|
|
|
Triggers detection of violations of the CERT recommendation ERR09-CPP. Throw
|
|
anonymous temporaries.
|
|
Default is `true`.
|
|
|
|
.. option:: WarnOnLargeObject
|
|
|
|
Also warns for any large, trivial object caught by value. Catching a large
|
|
object by value is not dangerous but affects the performance negatively. The
|
|
maximum size of an object allowed to be caught without warning can be set
|
|
using the `MaxSize` option.
|
|
Default is `false`.
|
|
|
|
.. option:: MaxSize
|
|
|
|
Determines the maximum size of an object allowed to be caught without
|
|
warning. Only applicable if :option:`WarnOnLargeObject` is set to `true`. If
|
|
the option is set by the user to `std::numeric_limits<uint64_t>::max()` then
|
|
it reverts to the default value.
|
|
Default is the size of `size_t`.
|