================ @@ -8480,6 +8480,54 @@ class LValueExprEvaluator }; } // end anonymous namespace +/// Get an lvalue to a field of a lambda's closure type. +static bool GetLambdaCaptureAsLValue(EvalInfo &Info, const Expr *E, + LValue &Result, const CXXMethodDecl *MD, + const FieldDecl *FD, + bool LValueToRValueConversion) { + // Static lambda function call operators can't have captures. We already + // diagnosed this, so bail out here. + if (MD->isStatic()) { + assert(Info.CurrentCall->This == nullptr && + "This should not be set for a static call operator"); + return false; + } + + // Start with 'Result' referring to the complete closure object... + if (MD->isExplicitObjectMemberFunction()) { + // Self may be passed by reference or by value. + auto *Self = MD->getParamDecl(0); + if (Self->getType()->isReferenceType()) { + APValue *RefValue = Info.getParamSlot(Info.CurrentCall->Arguments, Self); + Result.setFrom(Info.Ctx, *RefValue); + } else { + auto *VD = Info.CurrentCall->Arguments.getOrigParam(Self); + auto *Frame = + Info.getCallFrameAndDepth(Info.CurrentCall->Arguments.CallIndex) + .first; + auto Version = Info.CurrentCall->Arguments.Version; + Result.set({VD, Frame->Index, Version}); ---------------- cor3ntin wrote:
@AaronBallman https://github.com/llvm/llvm-project/pull/81102 _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits