brintos

brintos / llvm-project-archived public Read only

0
0
Text · 702 B · 887bdc6 Raw
23 lines · plain
1.. title:: clang-tidy - cppcoreguidelines-avoid-reference-coroutine-parameters2 3cppcoreguidelines-avoid-reference-coroutine-parameters4======================================================5 6Warns when a coroutine accepts reference parameters. After a coroutine suspend7point, references could be dangling and no longer valid. Instead, pass8parameters as values.9 10Examples:11 12.. code-block:: c++13 14  std::future<int> someCoroutine(int& val) {15    co_await ...;16    // When the coroutine is resumed, 'val' might no longer be valid.17    if (val) ...18  }19 20This check implements `CP.5321<https://isocpp.github.io/CppCoreGuidelines/CppCoreGuidelines#rcoro-reference-parameters>`_22from the C++ Core Guidelines.23