xref: /llvm-project/clang-tools-extra/docs/clang-tidy/checks/performance/noexcept-swap.rst (revision 356c2c2399e1041439af817e3e179aa35361502e)
1.. title:: clang-tidy - performance-noexcept-swap
2
3performance-noexcept-swap
4=========================
5
6The check flags user-defined swap and iter_swap functions not marked with ``noexcept`` or
7marked with ``noexcept(expr)`` where ``expr`` evaluates to ``false``
8(but is not a ``false`` literal itself).
9
10When a swap or iter_swap function is marked as ``noexcept``, it assures the compiler that
11no exceptions will be thrown during the swapping of two objects, which allows
12the compiler to perform certain optimizations such as omitting exception
13handling code.
14