================
@@ -79,6 +79,21 @@ class UseAfterMoveFinder {
   llvm::SmallPtrSet<const CFGBlock *, 8> Visited;
 };
 
+AST_MATCHER_P(CXXRecordDecl, hasCaptureByReference, const ValueDecl *,
+              TargetDecl) {
+  if (!Node.isLambda())
+    return false;
+
+  if (llvm::any_of(Node.captures(), [&](const auto &Capture) {
+        return Capture.capturesVariable() &&
+               Capture.getCaptureKind() == LCK_ByRef &&
+               Capture.getCapturedVar() == TargetDecl;
+      })) {
+    return true;
+  }
+  return false;
----------------
zwuis wrote:

`return Node.isLambda() && llvm::any_of(...);`

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

Reply via email to