================
@@ -0,0 +1,93 @@
+// RUN: %check_clang_tidy -std=c++23 %s 
cppcoreguidelines-avoid-capturing-lambda-coroutines %t \
+// RUN:   -- -config='{CheckOptions: 
{cppcoreguidelines-avoid-capturing-lambda-coroutines.AllowExplicitObjectParameters:
 true}}' \
----------------
WillemKauf wrote:

Added a test case with 

```
// RUN: %check_clang_tidy -std=c++23-or-later -check-suffix=,CPP23 %s 
cppcoreguidelines-avoid-capturing-lambda-coroutines %t \
// RUN:   -- -config='{CheckOptions: 
{cppcoreguidelines-avoid-capturing-lambda-coroutines.AllowExplicitObjectParameters:
 false}}' \
// RUN:   -- -isystem %S/Inputs/system -DCPP23
```

with test case

```cpp
#ifdef CPP23
    [&v](this auto) -> task { co_return; };
    // CHECK-MESSAGES-CPP23: [[@LINE-1]]:5: warning: coroutine lambda may cause 
use-after-free, avoid captures or ensure lambda closure object has guaranteed 
lifetime [cppcoreguidelines-avoid-capturing-lambda-coroutines]
#endif

```

In the existing test file `avoid-capturing-lambda-coroutines.cpp`.

https://github.com/llvm/llvm-project/pull/182916
_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to