================ @@ -4006,6 +4007,37 @@ class TreeTransform { NumExpansions); } + void RebuildLambdaExprImpl(SourceLocation StartLoc, SourceLocation EndLoc, + LambdaScopeInfo *LSI) {} + + ExprResult RebuildLambdaExpr(SourceLocation StartLoc, SourceLocation EndLoc, + LambdaScopeInfo *LSI) { + CXXRecordDecl *Class = LSI->Lambda; + CXXMethodDecl *CallOperator = LSI->CallOperator; + CallOperator->setLexicalDeclContext(Class); + Decl *TemplateOrNonTemplateCallOperatorDecl = + CallOperator->getDescribedFunctionTemplate() + ? CallOperator->getDescribedFunctionTemplate() + : cast<Decl>(CallOperator); + // FIXME: Is this really the best choice? Keeping the lexical decl context + // set as CurContext seems more faithful to the source. + TemplateOrNonTemplateCallOperatorDecl->setLexicalDeclContext(Class); + + getDerived().RebuildLambdaExprImpl(StartLoc, EndLoc, LSI); ---------------- zyn0217 wrote:
@cor3ntin Aha, I've figured out a way to simplify this `RebuildLambdaExpr()` thing: I think it's unnecessary to change the new method decl's lexical context to CurContext (we do so in parsing because we want to align the Scope nesting with the lexical nesting; however this is just what needs to be respected in parsing) and this way, we could just get rid of these setter calls. https://github.com/llvm/llvm-project/pull/86265 _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits