diff options
Diffstat (limited to 'clang/lib/Sema/Sema.cpp')
| -rw-r--r-- | clang/lib/Sema/Sema.cpp | 25 |
1 files changed, 21 insertions, 4 deletions
diff --git a/clang/lib/Sema/Sema.cpp b/clang/lib/Sema/Sema.cpp index 6cc596cec1b..aab03897963 100644 --- a/clang/lib/Sema/Sema.cpp +++ b/clang/lib/Sema/Sema.cpp @@ -1007,10 +1007,17 @@ void Sema::PushBlockScope(Scope *BlockScope, BlockDecl *Block) { BlockScope, Block)); } -void Sema::PushLambdaScope(CXXRecordDecl *Lambda, - CXXMethodDecl *CallOperator) { - FunctionScopes.push_back(new LambdaScopeInfo(getDiagnostics(), Lambda, - CallOperator)); +void Sema::PushLambdaScope() { + FunctionScopes.push_back(new LambdaScopeInfo(getDiagnostics())); +} + +void Sema::RecordParsingTemplateParameterDepth(unsigned Depth) { + if (LambdaScopeInfo *const LSI = getCurLambda()) { + LSI->AutoTemplateParameterDepth = Depth; + return; + } + assert(false && + "Remove assertion if intentionally called in a non-lambda context."); } void Sema::PopFunctionScopeInfo(const AnalysisBasedWarnings::Policy *WP, @@ -1066,6 +1073,16 @@ LambdaScopeInfo *Sema::getCurLambda() { return dyn_cast<LambdaScopeInfo>(FunctionScopes.back()); } +// We have a generic lambda if we parsed auto parameters, or we have +// an associated template parameter list. +LambdaScopeInfo *Sema::getCurGenericLambda() { + if (LambdaScopeInfo *LSI = getCurLambda()) { + return (LSI->AutoTemplateParams.size() || + LSI->GLTemplateParameterList) ? LSI : 0; + } + return 0; +} + void Sema::ActOnComment(SourceRange Comment) { if (!LangOpts.RetainCommentsFromSystemHeaders && |

