================
@@ -1113,10 +1113,14 @@ void
Sema::ActOnLambdaExpressionAfterIntroducer(LambdaIntroducer &Intro,
// The parameter var is not injected into the function Decl at the point of
// parsing lambda. In such scenarios, perceiving it as dependent could
// result in the constraint being evaluated, which matches what GCC does.
- while (P->getEntity() && P->getEntity()->isRequiresExprBody())
- P = P->getParent();
- if (P->isFunctionDeclarationScope() &&
- llvm::any_of(P->decls(), [](Decl *D) {
+ Scope *LookupScope = ParentScope;
+ while (LookupScope->getEntity() &&
+ LookupScope->getEntity()->isRequiresExprBody())
----------------
a-tarasyuk wrote:
@shafik Thanks for pointing that out. I found a few similar parent-scope walk
loops across `Sema`; not all of them use `isRequiresExprBody()`, but these
cases are more about duplicating the same walk-up pattern. If there are other
cases I missed, please point them out.
If you’re okay with introducing a helper that takes a callback and replaces
`while walk up`, I’ll do the follow-up in this PR.
https://github.com/llvm/llvm-project/blob/4998280c3f112facece8a7ce10f2788c800b7cba/clang/lib/Sema/SemaDecl.cpp#L1563-L1564
https://github.com/llvm/llvm-project/blob/4998280c3f112facece8a7ce10f2788c800b7cba/clang/lib/Sema/SemaDecl.cpp#L2343-L2346
https://github.com/llvm/llvm-project/blob/4998280c3f112facece8a7ce10f2788c800b7cba/clang/lib/Sema/SemaDecl.cpp#L9984-L9989
https://github.com/llvm/llvm-project/blob/4998280c3f112facece8a7ce10f2788c800b7cba/clang/lib/Sema/SemaDecl.cpp#L16970-L16973
https://github.com/llvm/llvm-project/blob/4998280c3f112facece8a7ce10f2788c800b7cba/clang/lib/Sema/SemaLookup.cpp#L2226-L2228
https://github.com/llvm/llvm-project/pull/173776
_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits