aboutsummaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorBen Langmuir <ben.langmuir@intel.com>2013-05-03 19:20:19 +0000
committerBen Langmuir <ben.langmuir@intel.com>2013-05-03 19:20:19 +0000
commitdc5be4f54d6415cb88b2f8a7c5bc9011e332b9b8 (patch)
treec0601b4fba10524868f196d5ee845dec53db48f6 /include
parent0f2fc5ff49cb9abd6c6972ffd6db066295672867 (diff)
Serialization for captured statements
Add serialization for captured statements and captured decls. Also add a const_capture_iterator to CapturedStmt. Test contributed by Wei Pan Differential Revision: http://llvm-reviews.chandlerc.com/D727 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@181048 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'include')
-rw-r--r--include/clang/AST/Decl.h7
-rw-r--r--include/clang/AST/Stmt.h11
2 files changed, 16 insertions, 2 deletions
diff --git a/include/clang/AST/Decl.h b/include/clang/AST/Decl.h
index 6c8c5051fe..ea6479ad28 100644
--- a/include/clang/AST/Decl.h
+++ b/include/clang/AST/Decl.h
@@ -3185,10 +3185,14 @@ private:
public:
static CapturedDecl *Create(ASTContext &C, DeclContext *DC, unsigned NumParams);
+ static CapturedDecl *CreateDeserialized(ASTContext &C, unsigned ID,
+ unsigned NumParams);
Stmt *getBody() const { return Body; }
void setBody(Stmt *B) { Body = B; }
+ unsigned getNumParams() const { return NumParams; }
+
ImplicitParamDecl *getParam(unsigned i) const {
assert(i < NumParams);
return getParams()[i];
@@ -3217,6 +3221,9 @@ public:
static CapturedDecl *castFromDeclContext(const DeclContext *DC) {
return static_cast<CapturedDecl *>(const_cast<DeclContext *>(DC));
}
+
+ friend class ASTDeclReader;
+ friend class ASTDeclWriter;
};
/// \brief Describes a module import declaration, which makes the contents
diff --git a/include/clang/AST/Stmt.h b/include/clang/AST/Stmt.h
index 6e5fae4f3c..da83220988 100644
--- a/include/clang/AST/Stmt.h
+++ b/include/clang/AST/Stmt.h
@@ -1975,6 +1975,7 @@ public:
assert(!capturesThis() && "No variable available for 'this' capture");
return VarAndKind.getPointer();
}
+ friend class ASTStmtReader;
};
private:
@@ -2001,6 +2002,8 @@ private:
Capture *getStoredCaptures() const;
+ void setCapturedStmt(Stmt *S) { getStoredStmts()[NumCaptures] = S; }
+
public:
static CapturedStmt *Create(ASTContext &Context, Stmt *S,
ArrayRef<Capture> Captures,
@@ -2026,10 +2029,12 @@ public:
bool capturesVariable(const VarDecl *Var) const;
/// \brief An iterator that walks over the captures.
- typedef const Capture *capture_iterator;
+ typedef Capture *capture_iterator;
+ typedef const Capture *const_capture_iterator;
/// \brief Retrieve an iterator pointing to the first capture.
- capture_iterator capture_begin() const { return getStoredCaptures(); }
+ capture_iterator capture_begin() { return getStoredCaptures(); }
+ const_capture_iterator capture_begin() const { return getStoredCaptures(); }
/// \brief Retrieve an iterator pointing past the end of the sequence of
/// captures.
@@ -2069,6 +2074,8 @@ public:
}
child_range children();
+
+ friend class ASTStmtReader;
};
} // end namespace clang