diff options
Diffstat (limited to 'include')
-rw-r--r-- | include/clang/AST/ExprCXX.h | 10 | ||||
-rw-r--r-- | include/clang/Sema/Sema.h | 30 |
2 files changed, 38 insertions, 2 deletions
diff --git a/include/clang/AST/ExprCXX.h b/include/clang/AST/ExprCXX.h index 7f68b2667f..ba2233d23b 100644 --- a/include/clang/AST/ExprCXX.h +++ b/include/clang/AST/ExprCXX.h @@ -1059,6 +1059,11 @@ class LambdaExpr : public Expr { /// implicit (and empty) parameter list. unsigned ExplicitParams : 1; + /// \brief Whether this lambda had the result type explicitly specified. + unsigned ExplicitResultType : 1; + + /// \brief Whether there are any array index variables stored at the end of + /// this lambda expression. unsigned HasArrayIndexVars : 1; /// \brief The location of the closing brace ('}') that completes @@ -1157,6 +1162,7 @@ private: LambdaCaptureDefault CaptureDefault, ArrayRef<Capture> Captures, bool ExplicitParams, + bool ExplicitResultType, ArrayRef<Expr *> CaptureInits, ArrayRef<VarDecl *> ArrayIndexVars, ArrayRef<unsigned> ArrayIndexStarts, @@ -1186,6 +1192,7 @@ public: LambdaCaptureDefault CaptureDefault, ArrayRef<Capture> Captures, bool ExplicitParams, + bool ExplicitResultType, ArrayRef<Expr *> CaptureInits, ArrayRef<VarDecl *> ArrayIndexVars, ArrayRef<unsigned> ArrayIndexStarts, @@ -1276,6 +1283,9 @@ public: /// list vs. an implicit (empty) parameter list. bool hasExplicitParameters() const { return ExplicitParams; } + /// \brief Whether this lambda had its result type explicitly specified. + bool hasExplicitResultType() const { return ExplicitResultType; } + static bool classof(const Stmt *T) { return T->getStmtClass() == LambdaExprClass; } diff --git a/include/clang/Sema/Sema.h b/include/clang/Sema/Sema.h index 2e5f8750db..6014fefe1b 100644 --- a/include/clang/Sema/Sema.h +++ b/include/clang/Sema/Sema.h @@ -3467,6 +3467,31 @@ public: /// initializer for the declaration 'Dcl'. void ActOnCXXExitDeclInitializer(Scope *S, Decl *Dcl); + /// \brief Create a new lambda closure type. + CXXRecordDecl *createLambdaClosureType(SourceRange IntroducerRange); + + /// \brief Start the definition of a lambda expression. + CXXMethodDecl *startLambdaDefinition(CXXRecordDecl *Class, + SourceRange IntroducerRange, + TypeSourceInfo *MethodType, + SourceLocation EndLoc); + + /// \brief Introduce the scope for a lambda expression. + sema::LambdaScopeInfo *enterLambdaScope(CXXMethodDecl *CallOperator, + SourceRange IntroducerRange, + LambdaCaptureDefault CaptureDefault, + bool ExplicitParams, + bool ExplicitResultType, + bool Mutable); + + /// \brief Note that we have finished the explicit captures for the + /// given lambda. + void finishLambdaExplicitCaptures(sema::LambdaScopeInfo *LSI); + + /// \brief Introduce the lambda parameters into scope. + void addLambdaParameters(CXXMethodDecl *CallOperator, Scope *CurScope, + llvm::ArrayRef<ParmVarDecl *> Params); + /// ActOnStartOfLambdaDefinition - This is called just before we start /// parsing the body of a lambda; it analyzes the explicit captures and /// arguments, and sets up various data-structures for the body of the @@ -3476,12 +3501,13 @@ public: /// ActOnLambdaError - If there is an error parsing a lambda, this callback /// is invoked to pop the information about the lambda. - void ActOnLambdaError(SourceLocation StartLoc, Scope *CurScope); + void ActOnLambdaError(SourceLocation StartLoc, Scope *CurScope, + bool IsInstantiation = false); /// ActOnLambdaExpr - This is called when the body of a lambda expression /// was successfully completed. ExprResult ActOnLambdaExpr(SourceLocation StartLoc, Stmt *Body, - Scope *CurScope); + Scope *CurScope, bool IsInstantiation = false); // ParseObjCStringLiteral - Parse Objective-C string literals. ExprResult ParseObjCStringLiteral(SourceLocation *AtLocs, |