llvm-project
e1f6dc4b - [clang-tidy] Add `AllowExplicitObjectParameters` option to `avoid-capturing-lambda-coroutines` (#182916)

Commit
24 days ago
[clang-tidy] Add `AllowExplicitObjectParameters` option to `avoid-capturing-lambda-coroutines` (#182916) Add an off-by-default `AllowExplicitObjectParameters` option to the existing `cppcoreguidelines-avoid-capturing-lambda-coroutines` check. When enabled, lambda coroutines that use C++23 "deducing this" (explicit object parameter) are not flagged, since captures are moved into the coroutine frame ([1], [2], [3]). In C++23 mode, the check also provides fix-it hints to add `this auto` as the first parameter for lambdas that don't use it. The option is off by default to match the current C++ Core Guidelines, which do not yet recognize explicit object parameters as a solution ([4]). Once the guidelines adopt the proposal, the default can be flipped. [1]: https://github.com/scylladb/seastar/blob/master/doc/lambda-coroutine-fiasco.md#solution-c23-and-up [2]: https://www.scs.stanford.edu/~dm/blog/vexing-capture.html [3]: https://lists.isocpp.org/std-proposals/2020/05/1391.php [4]: https://github.com/isocpp/CppCoreGuidelines/pull/2289#issuecomment-3756500251
Author
Parents
Loading