[cfe-commits] r43854 - in /cfe/trunk: AST/StmtSerialization.cpp include/clang/AST/Expr.h
Ted Kremenek
kremenek at apple.com
Wed Nov 7 15:32:20 PST 2007
Author: kremenek
Date: Wed Nov 7 17:32:20 2007
New Revision: 43854
URL: http://llvm.org/viewvc/llvm-project?rev=43854&view=rev
Log:
Implemented serialization of CallExpr.
Modified:
cfe/trunk/AST/StmtSerialization.cpp
cfe/trunk/include/clang/AST/Expr.h
Modified: cfe/trunk/AST/StmtSerialization.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/AST/StmtSerialization.cpp?rev=43854&r1=43853&r2=43854&view=diff
==============================================================================
--- cfe/trunk/AST/StmtSerialization.cpp (original)
+++ cfe/trunk/AST/StmtSerialization.cpp Wed Nov 7 17:32:20 2007
@@ -43,6 +43,9 @@
case BreakStmtClass:
return BreakStmt::directMaterialize(D);
+
+ case CallExprClass:
+ return CallExpr::directMaterialize(D);
case CaseStmtClass:
return CaseStmt::directMaterialize(D);
@@ -160,7 +163,24 @@
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());
Modified: cfe/trunk/include/clang/AST/Expr.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/AST/Expr.h?rev=43854&r1=43853&r2=43854&view=diff
==============================================================================
--- cfe/trunk/include/clang/AST/Expr.h (original)
+++ cfe/trunk/include/clang/AST/Expr.h Wed Nov 7 17:32:20 2007
@@ -533,6 +533,13 @@
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 @@
// 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.
More information about the cfe-commits
mailing list