diff options
Diffstat (limited to 'clang/lib/Parse/ParseExprCXX.cpp')
-rw-r--r-- | clang/lib/Parse/ParseExprCXX.cpp | 18 |
1 files changed, 15 insertions, 3 deletions
diff --git a/clang/lib/Parse/ParseExprCXX.cpp b/clang/lib/Parse/ParseExprCXX.cpp index 9ac6d435067..2eace9fc74f 100644 --- a/clang/lib/Parse/ParseExprCXX.cpp +++ b/clang/lib/Parse/ParseExprCXX.cpp @@ -10,7 +10,7 @@ // This file implements the Expression parsing implementation for C++. // //===----------------------------------------------------------------------===// - +#include "clang/AST/DeclTemplate.h" #include "clang/Parse/Parser.h" #include "RAIIObjectsForParser.h" #include "clang/Basic/PrettyStackTrace.h" @@ -21,6 +21,7 @@ #include "clang/Sema/Scope.h" #include "llvm/Support/ErrorHandling.h" + using namespace clang; static int SelectDigraphErrorMessage(tok::TokenKind Kind) { @@ -908,12 +909,16 @@ ExprResult Parser::ParseLambdaExpressionAfterIntroducer( PrettyStackTraceLoc CrashInfo(PP.getSourceManager(), LambdaBeginLoc, "lambda expression parsing"); + + // FIXME: Call into Actions to add any init-capture declarations to the // scope while parsing the lambda-declarator and compound-statement. // Parse lambda-declarator[opt]. DeclSpec DS(AttrFactory); Declarator D(DS, Declarator::LambdaExprContext); + TemplateParameterDepthRAII CurTemplateDepthTracker(TemplateParameterDepth); + Actions.PushLambdaScope(); if (Tok.is(tok::l_paren)) { ParseScope PrototypeScope(this, @@ -931,9 +936,16 @@ ExprResult Parser::ParseLambdaExpressionAfterIntroducer( SmallVector<DeclaratorChunk::ParamInfo, 16> ParamInfo; SourceLocation EllipsisLoc; - if (Tok.isNot(tok::r_paren)) + + if (Tok.isNot(tok::r_paren)) { + sema::LambdaScopeInfo *LSI = Actions.getCurLambda(); + Actions.RecordParsingTemplateParameterDepth(TemplateParameterDepth); ParseParameterDeclarationClause(D, Attr, ParamInfo, EllipsisLoc); - + // For a generic lambda, each 'auto' within the parameter declaration + // clause creates a template type parameter, so increment the depth. + if (Actions.getCurGenericLambda()) + ++CurTemplateDepthTracker; + } T.consumeClose(); SourceLocation RParenLoc = T.getCloseLocation(); DeclEndLoc = RParenLoc; |