[clang] [clang] Introduce [[clang::lifetime_capture_by(X)]] (PR #111499)

Utkarsh Saxena via cfe-commits cfe-commits at lists.llvm.org
Sun Nov 10 03:33:01 PST 2024


================
@@ -1199,6 +1213,17 @@ static void checkExprLifetimeImpl(Sema &SemaRef,
       break;
     }
 
+    case LK_LifetimeCapture: {
+      if (!MTE)
----------------
usx95 wrote:

I don't think we can easily support this without intraprocedural data flow. For example, consider the following:
```cpp
void f() {
  std::string local;
  addToSet(local);
  set.clear();
}
```

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


More information about the cfe-commits mailing list