diff options
Diffstat (limited to 'include/clang/AST/DeclCXX.h')
-rw-r--r-- | include/clang/AST/DeclCXX.h | 26 |
1 files changed, 23 insertions, 3 deletions
diff --git a/include/clang/AST/DeclCXX.h b/include/clang/AST/DeclCXX.h index 2b56871810..5487c77a3c 100644 --- a/include/clang/AST/DeclCXX.h +++ b/include/clang/AST/DeclCXX.h @@ -561,7 +561,8 @@ class CXXRecordDecl : public RecordDecl { typedef LambdaExpr::Capture Capture; LambdaDefinitionData(CXXRecordDecl *D) - : DefinitionData(D), NumCaptures(0), NumExplicitCaptures(0), Extra(0) { + : DefinitionData(D), NumCaptures(0), NumExplicitCaptures(0), + HasArrayIndexVars(false), Extra(0) { IsLambda = true; } @@ -569,15 +570,22 @@ class CXXRecordDecl : public RecordDecl { unsigned NumCaptures : 16; /// \brief The number of explicit captures in this lambda. - unsigned NumExplicitCaptures : 16; + unsigned NumExplicitCaptures : 15; + /// \brief Whether This lambda has any by-copy array captures, and therefore + /// has array index variables. + unsigned HasArrayIndexVars : 1; + /// \brief The "extra" data associated with the lambda, including - /// captures, capture initializers, and the body of the lambda. + /// captures, capture initializers, the body of the lambda, and the + /// array-index variables for array captures. void *Extra; /// \brief Allocate the "extra" data associated with a lambda definition. void allocateExtra(ArrayRef<Capture> Captures, ArrayRef<Expr *> CaptureInits, + ArrayRef<VarDecl *> ArrayIndexVars, + ArrayRef<unsigned> ArrayIndexStarts, Stmt *Body); /// \brief Retrieve the set of captures. @@ -588,6 +596,18 @@ class CXXRecordDecl : public RecordDecl { Stmt **getStoredStmts() const { return reinterpret_cast<Stmt **>(getCaptures() + NumCaptures); } + + /// \brief Retrieve the mapping from captures to the first array index + /// variable. + unsigned *getArrayIndexStarts() const { + return reinterpret_cast<unsigned *>(getStoredStmts() + NumCaptures + 1); + } + + /// \brief Retrieve the complete set of array-index variables. + VarDecl **getArrayIndexVars() const { + return reinterpret_cast<VarDecl **>( + getArrayIndexStarts() + NumCaptures + 1); + } }; struct DefinitionData &data() { |