================ @@ -2379,23 +2379,32 @@ Sema::LambdaScopeForCallOperatorInstantiationRAII:: SemaRef.RebuildLambdaScopeInfo(cast<CXXMethodDecl>(FD)); - FunctionDecl *Pattern = getPatternFunctionDecl(FD); - if (Pattern) { - SemaRef.addInstantiatedCapturesToScope(FD, Pattern, Scope, MLTAL); + FunctionDecl *FDPattern = getPatternFunctionDecl(FD); + if (!FDPattern) + return; - FunctionDecl *ParentFD = FD; - while (ShouldAddDeclsFromParentScope) { + SemaRef.addInstantiatedCapturesToScope(FD, FDPattern, Scope, MLTAL); - ParentFD = - dyn_cast<FunctionDecl>(getLambdaAwareParentOfDeclContext(ParentFD)); - Pattern = - dyn_cast<FunctionDecl>(getLambdaAwareParentOfDeclContext(Pattern)); + if (!ShouldAddDeclsFromParentScope) + return; - if (!ParentFD || !Pattern) - break; + llvm::SmallVector<std::pair<FunctionDecl *, FunctionDecl *>, 4> + ParentInstantiations; + std::pair<FunctionDecl *, FunctionDecl *> Current = {FDPattern, FD}; + while (true) { + Current.first = dyn_cast<FunctionDecl>( + getLambdaAwareParentOfDeclContext(Current.first)); + Current.second = dyn_cast<FunctionDecl>( + getLambdaAwareParentOfDeclContext(Current.second)); ---------------- zyn0217 wrote:
Using `.first` and `.second` seems a bit unclear. Can we wrap them into a local struct? https://github.com/llvm/llvm-project/pull/97215 _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits