================
@@ -150,6 +165,61 @@ makeReinitMatcher(const ValueDecl *MovedVariable,
       .bind("reinit");
 }
 
+static bool
+isVariableResetInLambda(const Stmt *Body, const ValueDecl *MovedVariable,
+                        ASTContext *Context,
+                        llvm::ArrayRef<StringRef> InvalidationFunctions) {
+  assert(Body && "There should be a lambda body");
+
+  // If the variable is not mentioned at all in the lambda body,
+  // it cannot be reinitialized.
+  const auto VariableMentionMatcher = stmt(anyOf(
+      hasDescendant(declRefExpr(hasDeclaration(equalsNode(MovedVariable)))),
+      hasDescendant(memberExpr(hasDeclaration(equalsNode(MovedVariable))))));
+
+  if (match(VariableMentionMatcher, *Body, *Context).empty())
+    return false;
+
+  CFG::BuildOptions Options;
+  Options.AddImplicitDtors = true;
+  Options.AddTemporaryDtors = true;
+  Options.PruneTriviallyFalseEdges = true;
+
+  std::unique_ptr<CFG> TheCFG =
+      CFG::buildCFG(nullptr, const_cast<Stmt *>(Body), Context, Options);
----------------
zwuis wrote:

`/*D=*/nullptr`

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