Debian Codegraph @

clang-tools-extra/docs/clang-tidy/checks/cppcoreguidelines/avoid-reference-coroutine-parameters.rst

raw
1 .. title:: clang-tidy - cppcoreguidelines-avoid-reference-coroutine-parameters
2
3 cppcoreguidelines-avoid-reference-coroutine-parameters
4 ======================================================
5
6 Warns when a coroutine accepts reference parameters. After a coroutine suspend point,
7 references could be dangling and no longer valid. Instead, pass parameters as values.
8
9 Examples:
10
11 .. code-block:: c++
12
13 std::future<int> someCoroutine(int& val) {
14 co_await ...;
15 // When the coroutine is resumed, 'val' might no longer be valid.
16 if (val) ...
17 }
18
19 This check implements `CP.53
20 <https://isocpp.github.io/CppCoreGuidelines/CppCoreGuidelines#Rcoro-reference-parameters>`_
21 from the C++ Core Guidelines.