diff options
| author | Dimitry Andric <dim@FreeBSD.org> | 2016-11-25 19:07:40 +0000 |
|---|---|---|
| committer | Dimitry Andric <dim@FreeBSD.org> | 2016-11-25 19:07:40 +0000 |
| commit | 17c7957f023f02fc2c88f51f8908c19b52609275 (patch) | |
| tree | c654618ff2d38e26916b49614d89fe01f4a4818d /lib/Sema/Sema.cpp | |
| parent | c477790a57f44875b9de2043f2eb47dff2d20133 (diff) | |
Notes
Diffstat (limited to 'lib/Sema/Sema.cpp')
| -rw-r--r-- | lib/Sema/Sema.cpp | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/lib/Sema/Sema.cpp b/lib/Sema/Sema.cpp index a242ace9f64e..777747606304 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. |
