================
@@ -431,6 +439,27 @@ void FactsGenerator::VisitMaterializeTemporaryExpr(
}
}
+void FactsGenerator::VisitLambdaExpr(const LambdaExpr *LE) {
+ // The lambda gets a single merged origin that aggregates all captured
+ // pointer-like origins. Currently we only need to detect whether the lambda
+ // outlives any capture.
+ OriginList *LambdaList = getOriginsList(*LE);
+ if (!LambdaList)
+ return;
+ bool Kill = true;
+ for (unsigned I = 0; I < LE->capture_size(); ++I) {
+ const Expr *Init = LE->capture_init_begin()[I];
+ if (!Init)
+ continue;
----------------
Xazax-hun wrote:
Could we use a range based for here?
```suggestion
for (auto init : LE->capture_inits()) {
if (!Init)
continue;
```
Also, do you see cases where the `Init` is null? When?
I think captures and capture_inits are two different concepts here. And mixing
the two in this loop is not a good idea, prone to out of bound errors.
We probably want to process all the captures, not just the inits?
https://github.com/llvm/llvm-project/pull/185216
_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits