================
@@ -3040,12 +3040,32 @@ void ExprEngine::VisitCommonDeclRefExpr(const Expr *Ex,
const NamedDecl *D,
// Sema follows a sequence of complex rules to determine whether the
// variable should be captured.
if (const FieldDecl *FD = LambdaCaptureFields[VD]) {
- Loc CXXThis = svalBuilder.getCXXThis(MD, SF);
- SVal CXXThisVal = state->getSVal(CXXThis);
- return std::make_pair(state->getLValue(FD, CXXThisVal), FD->getType());
+ if (MD->isImplicitObjectMemberFunction()) {
+ Loc CXXThis = svalBuilder.getCXXThis(MD, SF);
+ SVal CXXThisVal = state->getSVal(CXXThis);
+ return std::make_pair(state->getLValue(FD, CXXThisVal),
+ FD->getType());
+ }
+ const ParmVarDecl *PVD = MD->getParamDecl(0);
+ if (const Expr *CallSite = SF->getCallSite()) {
+ unsigned Idx = PVD->getFunctionScopeIndex();
+ const ParamVarRegion *PVR =
+ state->getStateManager().getRegionManager().getParamVarRegion(
+ CallSite, Idx, SF);
+ const Expr *SelfArgExpr = cast<CallExpr>(CallSite)->getArg(0);
+ if (PVD->getType()->isReferenceType()) {
+ state = state->bindLoc(loc::MemRegionVal(PVR),
+ state->getSVal(SelfArgExpr,
SF->getParent()),
+ SF);
+ SVal ParamSVal = state->getSVal(loc::MemRegionVal(PVR));
+ return std::make_pair(state->getLValue(FD, ParamSVal),
----------------
benedekaibas wrote:
With implementing the function `resolveLambdaCapturedVar` in
[9c54a9b](https://github.com/llvm/llvm-project/pull/219726/commits/9c54a9ba6ebd4f50e021855294c40465bae60de2)
the return expression is now simplified.
https://github.com/llvm/llvm-project/pull/219726
_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits