diff options
author | Douglas Gregor <dgregor@apple.com> | 2012-02-13 22:00:16 +0000 |
---|---|---|
committer | Douglas Gregor <dgregor@apple.com> | 2012-02-13 22:00:16 +0000 |
commit | dfca6f53ab97d28d43e3fa2564209df08f3d282c (patch) | |
tree | 1e1a5459162a72d9f5d1306def0035c13cae51ec /include/clang/AST/ExprCXX.h | |
parent | 07e5288c6532c8a61278fab4e0ae058ec81a0f5c (diff) |
Introduce support for template instantiation of lambda
expressions. This is mostly a simple refact, splitting the main "start
a lambda expression" function into smaller chunks that are driven
either from the parser (Sema::ActOnLambdaExpr) or during AST
transformation (TreeTransform::TransformLambdaExpr). A few minor
interesting points:
- Added new entry points for TreeTransform, so that we can
explicitly establish the link between the lambda closure type in the
template and the lambda closure type in the instantiation.
- Added a bit into LambdaExpr specifying whether it had an explicit
result type or not. We should have had this anyway.
This code is 'lightly' tested.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@150417 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'include/clang/AST/ExprCXX.h')
-rw-r--r-- | include/clang/AST/ExprCXX.h | 10 |
1 files changed, 10 insertions, 0 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; } |