clang-tidy - modernize-use-noexcept
This check replaces deprecated dynamic exception specifications with the appropriate noexcept specification (introduced in C++11). By default this check will replace throw()
with noexcept
, and throw(<exception>[,...])
or throw(...)
with noexcept(false)
.
transforms to:
ReplacementString
Users can use ReplacementString
to specify a macro to use instead of noexcept
. This is useful when maintaining source code that uses custom exception specification marking other than noexcept
. Fix-it hints will only be generated for non-throwing specifications.
transforms to:
if the ReplacementString
option is set to NOEXCEPT.
UseNoexceptFalse
Enabled by default, disabling will generate fix-it hints that remove throwing dynamic exception specs, e.g., throw(<something>)
, completely without providing a replacement text, except for destructors and delete operators that are noexcept(true)
by default.
transforms to:
if the UseNoexceptFalse
option is set to 0.