[clang] [coroutines][coro_lifetimebound] Detect lifetime issues with lambda captures (PR #77066)

Chuanqi Xu via cfe-commits cfe-commits at lists.llvm.org
Sun Jan 14 19:31:17 PST 2024


================
@@ -1796,6 +1797,32 @@ bool CoroutineStmtBuilder::makeOnException() {
   return true;
 }
 
+// Adds [[clang::coro_wrapper]] and [[clang::coro_disable_lifetimebound]]
+// attributes to the function `get_return_object`.
+static void handleGetReturnObject(Sema &S, Expr *E) {
+  if (auto *TE = dyn_cast<CXXBindTemporaryExpr>(E))
+    E = TE->getSubExpr();
+  auto *CE = dyn_cast<CallExpr>(E);
+  assert(CE);
----------------
ChuanqiXu9 wrote:

```suggestion
  auto *CE = cast<CallExpr>(E);
```

https://github.com/llvm/llvm-project/pull/77066


More information about the cfe-commits mailing list