diff options
author | Douglas Gregor <dgregor@apple.com> | 2012-02-13 16:35:30 +0000 |
---|---|---|
committer | Douglas Gregor <dgregor@apple.com> | 2012-02-13 16:35:30 +0000 |
commit | 9daa7bfdff7256cef693d7bf10084881bcb9253c (patch) | |
tree | 8902ff401da72f1c89e61f0f6dcf47dfb0088b5c /include/clang/AST/DeclCXX.h | |
parent | 3b66d7b73536ccf8612504f1edb56fa360a73947 (diff) |
Keep track of the set of array index variables we use when we
synthesize a by-copy captured array in a lambda. This information will
be needed by IR generation.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@150396 91177308-0d34-0410-b5e6-96231b3b80d8
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() { |