================ @@ -0,0 +1,31 @@ +.. title:: clang-tidy - bugprone-unsafe-to-allow-exceptions + +bugprone-unsafe-to-allow-exceptions +=================================== + +Finds functions where throwing exceptions is unsafe but the function is still +marked as throwable. Throwing exceptions from the following functions can be +problematic: + +* Destructors +* Move constructors +* Move assignment operators +* The ``main()`` functions +* ``swap()`` functions +* ``iter_swap()`` functions +* ``iter_move()`` functions + +The check finds any of these functions if it is marked with ``noexcept(false)`` +or ``throw(exception)``. This would indicate that the function is expected to +throw exceptions. Only the presence of these keywords is checked, not if the +function actually throws any exception. + +Options +------- + +.. option:: CheckedSwapFunctions ---------------- NagyDonat wrote:
Are we sure that the users will only want to use this for swap functions? If there is a reasonable chance that some users would want to add other kinds of names to this list, then perhaps we should rename this option to `CheckedFunctions`. (Of course the users could specify non-swap functions with the current option name as well, but it would be inelegant to force them to do so.) Also, perhaps we should allow specifying regular expressions instead of just literal function names. If this checker will eventually need regular expressions, then immediately allowing them would be much smoother than introducing them later, as in `bugprone-unsafe-functions` where it caused annoyances and buggy behavior. @balazske _@ other reviewers_ What do you think about allowing regular expressions? Would it be an useful feature or just a needless complication? https://github.com/llvm/llvm-project/pull/176430 _______________________________________________ cfe-commits mailing list [email protected] https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
