aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-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.