[cfe-commits] r43818 - in /cfe/trunk: AST/StmtSerialization.cpp include/clang/AST/Stmt.h
Ted Kremenek
kremenek at apple.com
Wed Nov 7 00:07:48 PST 2007
Author: kremenek
Date: Wed Nov 7 02:07:46 2007
New Revision: 43818
URL: http://llvm.org/viewvc/llvm-project?rev=43818&view=rev
Log:
Implemented serialization of GotoStmt.
Modified:
cfe/trunk/AST/StmtSerialization.cpp
cfe/trunk/include/clang/AST/Stmt.h
Modified: cfe/trunk/AST/StmtSerialization.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/AST/StmtSerialization.cpp?rev=43818&r1=43817&r2=43818&view=diff
==============================================================================
--- cfe/trunk/AST/StmtSerialization.cpp (original)
+++ cfe/trunk/AST/StmtSerialization.cpp Wed Nov 7 02:07:46 2007
@@ -57,6 +57,9 @@
case ForStmtClass:
return ForStmt::directMaterialize(D);
+
+ case GotoStmtClass:
+ return GotoStmt::directMaterialize(D);
case IfStmtClass:
return IfStmt::directMaterialize(D);
@@ -224,6 +227,20 @@
return new ForStmt(Init,Cond,Inc,Body,ForLoc);
}
+void GotoStmt::directEmit(llvm::Serializer& S) const {
+ S.Emit(GotoLoc);
+ S.Emit(LabelLoc);
+ S.EmitPtr(Label);
+}
+
+GotoStmt* GotoStmt::directMaterialize(llvm::Deserializer& D) {
+ SourceLocation GotoLoc = SourceLocation::ReadVal(D);
+ SourceLocation LabelLoc = SourceLocation::ReadVal(D);
+ GotoStmt* stmt = new GotoStmt(NULL,GotoLoc,LabelLoc);
+ D.ReadPtr(stmt->Label); // This pointer may be backpatched later.
+ return stmt;
+}
+
void IfStmt::directEmit(llvm::Serializer& S) const {
S.Emit(IfLoc);
S.EmitOwnedPtr(getCond());
Modified: cfe/trunk/include/clang/AST/Stmt.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/AST/Stmt.h?rev=43818&r1=43817&r2=43818&view=diff
==============================================================================
--- cfe/trunk/include/clang/AST/Stmt.h (original)
+++ cfe/trunk/include/clang/AST/Stmt.h Wed Nov 7 02:07:46 2007
@@ -593,6 +593,9 @@
// Iterators
virtual child_iterator child_begin();
virtual child_iterator child_end();
+
+ virtual void directEmit(llvm::Serializer& S) const;
+ static GotoStmt* directMaterialize(llvm::Deserializer& D);
};
/// IndirectGotoStmt - This represents an indirect goto.
More information about the cfe-commits
mailing list