summaryrefslogtreecommitdiff
path: root/lib/Sema/Sema.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'lib/Sema/Sema.cpp')
-rw-r--r--lib/Sema/Sema.cpp12
1 files changed, 10 insertions, 2 deletions
diff --git a/lib/Sema/Sema.cpp b/lib/Sema/Sema.cpp
index a242ace9f64ee..7777476063041 100644
--- a/lib/Sema/Sema.cpp
+++ b/lib/Sema/Sema.cpp
@@ -1197,11 +1197,19 @@ BlockScopeInfo *Sema::getCurBlock() {
return CurBSI;
}
-LambdaScopeInfo *Sema::getCurLambda() {
+LambdaScopeInfo *Sema::getCurLambda(bool IgnoreCapturedRegions) {
if (FunctionScopes.empty())
return nullptr;
- auto CurLSI = dyn_cast<LambdaScopeInfo>(FunctionScopes.back());
+ auto I = FunctionScopes.rbegin();
+ if (IgnoreCapturedRegions) {
+ auto E = FunctionScopes.rend();
+ while (I != E && isa<CapturedRegionScopeInfo>(*I))
+ ++I;
+ if (I == E)
+ return nullptr;
+ }
+ auto *CurLSI = dyn_cast<LambdaScopeInfo>(*I);
if (CurLSI && CurLSI->Lambda &&
!CurLSI->Lambda->Encloses(CurContext)) {
// We have switched contexts due to template instantiation.