xref: /llvm-project/clang-tools-extra/docs/clang-tidy/checks/bugprone/no-escape.rst (revision 6e566bc5523f743bc34a7e26f050f1f2b4d699a8)
1.. title:: clang-tidy - bugprone-no-escape
2
3bugprone-no-escape
4==================
5
6Finds pointers with the ``noescape`` attribute that are captured by an
7asynchronously-executed block. The block arguments in ``dispatch_async()`` and
8``dispatch_after()`` are guaranteed to escape, so it is an error if a pointer with the
9``noescape`` attribute is captured by one of these blocks.
10
11The following is an example of an invalid use of the ``noescape`` attribute.
12
13  .. code-block:: objc
14
15    void foo(__attribute__((noescape)) int *p) {
16      dispatch_async(queue, ^{
17        *p = 123;
18      });
19    });
20