aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTed Kremenek <kremenek@apple.com>2007-11-07 08:07:46 +0000
committerTed Kremenek <kremenek@apple.com>2007-11-07 08:07:46 +0000
commit3f0767b74b16b37bcce60ff457609161a0665784 (patch)
tree0a6db4103e6253f44d7a5268e6d70e26c0afb061
parent07ba046c7d7bbc1f42b86b3ed012eec8fc7849da (diff)
Implemented serialization of GotoStmt.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@43818 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r--AST/StmtSerialization.cpp17
-rw-r--r--include/clang/AST/Stmt.h3
2 files changed, 20 insertions, 0 deletions
diff --git a/AST/StmtSerialization.cpp b/AST/StmtSerialization.cpp
index 61e70ecde8..e4a43acd33 100644
--- a/AST/StmtSerialization.cpp
+++ b/AST/StmtSerialization.cpp
@@ -57,6 +57,9 @@ Stmt* Stmt::Materialize(llvm::Deserializer& D) {
case ForStmtClass:
return ForStmt::directMaterialize(D);
+
+ case GotoStmtClass:
+ return GotoStmt::directMaterialize(D);
case IfStmtClass:
return IfStmt::directMaterialize(D);
@@ -224,6 +227,20 @@ ForStmt* ForStmt::directMaterialize(llvm::Deserializer& D) {
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());
diff --git a/include/clang/AST/Stmt.h b/include/clang/AST/Stmt.h
index ed44687da0..e35ca4671e 100644
--- a/include/clang/AST/Stmt.h
+++ b/include/clang/AST/Stmt.h
@@ -593,6 +593,9 @@ public:
// 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.