================
@@ -2897,6 +2897,15 @@ DEF_TRAVERSE_STMT(LambdaExpr, {
   if (getDerived().shouldVisitImplicitCode()) {
     // The implicit model is simple: everything else is in the lambda class.
     TRY_TO(TraverseDecl(S->getLambdaClass()));
+
+    // The body is normally reached through the call operator of the closure
+    // class. If that declaration is not a definition (which happens when the
+    // closure type was merged with one from another module), visit the body
+    // through the lambda expression.
+    if (CXXMethodDecl *CallOp = S->getCallOperator();
+        CallOp && !CallOp->isThisDeclarationADefinition() &&
+        getDerived().shouldVisitLambdaBody())
+      TRY_TO_TRAVERSE_OR_ENQUEUE_STMT(S->getBody());
----------------
Maoyao233 wrote:

In common case, the new branch is a single check per lambda, and adds no 
traversal to normal lambdas. Note that the explicit mode already traverses 
`S->getBody()` unconditionally for every lambda -- What we are fixing is that 
implicit mode silently dose less than that in some edge cases.

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

Reply via email to