================
@@ -253,6 +253,17 @@ class RawPtrRefLambdaCapturesChecker
         auto *Callee = CE->getCallee();
         if (!Callee)
           return;
+        Callee = Callee->IgnoreParenCasts();
+        if (auto *MTE = dyn_cast<MaterializeTemporaryExpr>(Callee)) {
+          Callee = MTE->getSubExpr();
+          if (!Callee)
+            return;
+          Callee = Callee->IgnoreParenCasts();
+        }
+        if (auto *L = dyn_cast_or_null<LambdaExpr>(Callee)) {
----------------
steakhal wrote:

I think `Callee` cannot be null here because:
 - Callee was checked against null once we acquired it from `getCallee()`
 - `IgnoreParenCasts` always returns non null.

```suggestion
        if (auto *L = dyn_cast<LambdaExpr>(Callee)) {
```

Also by judging the density of the `dyn_casts`, I wonder if we should have 
chosen a `StmtVisitor` to mimic the pattern matching ad-hoc implemented here. 
No actions expected with this point, I'm just curious if it was considered.

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

Reply via email to