================
@@ -253,9 +262,10 @@ bool isASafeCallArg(const Expr *E) {
           return true;
       }
     } else if (auto *BD = dyn_cast_or_null<BindingDecl>(FoundDecl)) {
-      VarDecl *VD = BD->getHoldingVar();
-      if (VD && (isa<ParmVarDecl>(VD) || VD->isLocalVarDecl()))
-        return true;
+      if (VarDecl *VD = BD->getHoldingVar()) {
+        if (IsCheckedLocalVarOrParam(VD))
+          return true;
+      }
----------------
steakhal wrote:

Do you have tests covering this part? aka. structured-bindings?

The holding var is usually a structured type or tuple - of which the relevant 
fields are referenced by the BindingDecl. For example: `auto [a,b] = 
std::pair(2,4);`
Where this is basically desugared into:
```
auto holdingvar = std::pair(2,4);
auto a = holdingvar.first;
auto b = holdingvar.second;
```

Consequently, I expect it to be rare that the holdingvar would be of some 
interesting type - but rather its parts.

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

Reply via email to