aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTed Kremenek <kremenek@apple.com>2007-11-07 23:32:20 +0000
committerTed Kremenek <kremenek@apple.com>2007-11-07 23:32:20 +0000
commitd7fe4ea296646f049e4ff4cc37aa92ff4014a6b3 (patch)
tree551414a3aece4538c4a6787798bc7560b5a0935e
parent96fa54fc6dc7f4c8dad1fb22fc7fc4f4d775d6c0 (diff)
Implemented serialization of CallExpr.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@43854 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r--AST/StmtSerialization.cpp22
-rw-r--r--include/clang/AST/Expr.h10
2 files changed, 31 insertions, 1 deletions
diff --git a/AST/StmtSerialization.cpp b/AST/StmtSerialization.cpp
index a928c88c3a..91caff8e2d 100644
--- a/AST/StmtSerialization.cpp
+++ b/AST/StmtSerialization.cpp
@@ -43,6 +43,9 @@ Stmt* Stmt::Materialize(Deserializer& D) {
case BreakStmtClass:
return BreakStmt::directMaterialize(D);
+
+ case CallExprClass:
+ return CallExpr::directMaterialize(D);
case CaseStmtClass:
return CaseStmt::directMaterialize(D);
@@ -160,7 +163,24 @@ BreakStmt* BreakStmt::directMaterialize(Deserializer& D) {
SourceLocation Loc = SourceLocation::ReadVal(D);
return new BreakStmt(Loc);
}
-
+
+void CallExpr::directEmit(Serializer& S) const {
+ S.Emit(getType());
+ S.Emit(RParenLoc);
+ S.EmitInt(NumArgs);
+ S.BatchEmitOwnedPtrs(NumArgs+1,SubExprs);
+}
+
+CallExpr* CallExpr::directMaterialize(Deserializer& D) {
+ QualType t = QualType::ReadVal(D);
+ SourceLocation L = SourceLocation::ReadVal(D);
+ unsigned NumArgs = D.ReadInt();
+ Expr** SubExprs = new Expr*[NumArgs+1];
+ D.BatchReadOwnedPtrs(NumArgs+1,SubExprs);
+
+ return new CallExpr(SubExprs,NumArgs,t,L);
+}
+
void CaseStmt::directEmit(Serializer& S) const {
S.Emit(CaseLoc);
S.EmitPtr(getNextSwitchCase());
diff --git a/include/clang/AST/Expr.h b/include/clang/AST/Expr.h
index 77ebbf4501..718f328e41 100644
--- a/include/clang/AST/Expr.h
+++ b/include/clang/AST/Expr.h
@@ -533,6 +533,13 @@ class CallExpr : public Expr {
Expr **SubExprs;
unsigned NumArgs;
SourceLocation RParenLoc;
+
+ // This version of the ctor is for deserialization.
+ CallExpr(Expr** subexprs, unsigned numargs, QualType t,
+ SourceLocation rparenloc)
+ : Expr(CallExprClass,t), SubExprs(subexprs),
+ NumArgs(numargs), RParenLoc(rparenloc) {}
+
public:
CallExpr(Expr *fn, Expr **args, unsigned numargs, QualType t,
SourceLocation rparenloc);
@@ -579,6 +586,9 @@ public:
// Iterators
virtual child_iterator child_begin();
virtual child_iterator child_end();
+
+ virtual void directEmit(llvm::Serializer& S) const;
+ static CallExpr* directMaterialize(llvm::Deserializer& D);
};
/// MemberExpr - [C99 6.5.2.3] Structure and Union Members.