================
@@ -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:
@cor3ntin, thanks for the feedback.
There’s an existing pattern around `isTransparentContext`, however, I haven’t
found similar duplicated handling for `isRequiresExprBody`. I thought about
moving this walk-up logic into a helper that accepts a callback, like
```cpp
findNearestEntityScope(Scope *S, llvm::function_ref<bool(const DeclContext &)>
Predicate) {
while (S && S->getEntity() && Predicate(*S->getEntity()))
S = S->getParent();
return S;
}
....
```
I’m unsure whether this is a good fit for a new helper. WDYT?
https://github.com/llvm/llvm-project/pull/173776
_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits