aboutsummaryrefslogtreecommitdiff
path: root/include/clang/AST/Stmt.h
diff options
context:
space:
mode:
authorWei Pan <wei.pan@intel.com>2013-05-04 03:59:06 +0000
committerWei Pan <wei.pan@intel.com>2013-05-04 03:59:06 +0000
commit9fd6b8f5a73788f288edd01fa99d434d1e6588ad (patch)
tree9e9b626021de2b27472f3275c451c4d7d3e7f091 /include/clang/AST/Stmt.h
parentcd904e8864637e427f5ea3bf35a26e79b3dbbadf (diff)
downloadclang-9fd6b8f5a73788f288edd01fa99d434d1e6588ad.tar.gz
Implement template support for CapturedStmt
- Sema tests added and CodeGen tests are pending Differential Revision: http://llvm-reviews.chandlerc.com/D728 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@181101 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'include/clang/AST/Stmt.h')
-rw-r--r--include/clang/AST/Stmt.h39
1 files changed, 33 insertions, 6 deletions
diff --git a/include/clang/AST/Stmt.h b/include/clang/AST/Stmt.h
index da83220988..74c9ec2053 100644
--- a/include/clang/AST/Stmt.h
+++ b/include/clang/AST/Stmt.h
@@ -16,6 +16,7 @@
#include "clang/AST/DeclGroup.h"
#include "clang/AST/StmtIterator.h"
+#include "clang/Basic/CapturedStmt.h"
#include "clang/Basic/IdentifierTable.h"
#include "clang/Basic/LLVM.h"
#include "clang/Basic/SourceLocation.h"
@@ -1982,16 +1983,16 @@ private:
/// \brief The number of variable captured, including 'this'.
unsigned NumCaptures;
- /// \brief The implicit outlined function.
- CapturedDecl *TheCapturedDecl;
+ /// \brief The pointer part is the implicit the outlined function and the
+ /// int part is the captured region kind, 'CR_Default' etc.
+ llvm::PointerIntPair<CapturedDecl *, 1, CapturedRegionKind> CapDeclAndKind;
/// \brief The record for captured variables, a RecordDecl or CXXRecordDecl.
RecordDecl *TheRecordDecl;
/// \brief Construct a captured statement.
- CapturedStmt(Stmt *S, ArrayRef<Capture> Captures,
- ArrayRef<Expr *> CaptureInits,
- CapturedDecl *CD, RecordDecl *RD);
+ CapturedStmt(Stmt *S, CapturedRegionKind Kind, ArrayRef<Capture> Captures,
+ ArrayRef<Expr *> CaptureInits, CapturedDecl *CD, RecordDecl *RD);
/// \brief Construct an empty captured statement.
CapturedStmt(EmptyShell Empty, unsigned NumCaptures);
@@ -2006,6 +2007,7 @@ private:
public:
static CapturedStmt *Create(ASTContext &Context, Stmt *S,
+ CapturedRegionKind Kind,
ArrayRef<Capture> Captures,
ArrayRef<Expr *> CaptureInits,
CapturedDecl *CD, RecordDecl *RD);
@@ -2020,11 +2022,36 @@ public:
}
/// \brief Retrieve the outlined function declaration.
- CapturedDecl *getCapturedDecl() const { return TheCapturedDecl; }
+ CapturedDecl *getCapturedDecl() { return CapDeclAndKind.getPointer(); }
+ const CapturedDecl *getCapturedDecl() const {
+ return const_cast<CapturedStmt *>(this)->getCapturedDecl();
+ }
+
+ /// \brief Set the outlined function declaration.
+ void setCapturedDecl(CapturedDecl *D) {
+ assert(D && "null CapturedDecl");
+ CapDeclAndKind.setPointer(D);
+ }
+
+ /// \brief Retrieve the captured region kind.
+ CapturedRegionKind getCapturedRegionKind() const {
+ return CapDeclAndKind.getInt();
+ }
+
+ /// \brief Set the captured region kind.
+ void setCapturedRegionKind(CapturedRegionKind Kind) {
+ CapDeclAndKind.setInt(Kind);
+ }
/// \brief Retrieve the record declaration for captured variables.
const RecordDecl *getCapturedRecordDecl() const { return TheRecordDecl; }
+ /// \brief Set the record declaration for captured variables.
+ void setCapturedRecordDecl(RecordDecl *D) {
+ assert(D && "null RecordDecl");
+ TheRecordDecl = D;
+ }
+
/// \brief True if this variable has been captured.
bool capturesVariable(const VarDecl *Var) const;