diff --git a/clang/AST/StmtSerialization.cpp b/clang/AST/StmtSerialization.cpp index e4a43acd33e5..e0b87c7cabd8 100644 --- a/clang/AST/StmtSerialization.cpp +++ b/clang/AST/StmtSerialization.cpp @@ -64,6 +64,9 @@ Stmt* Stmt::Materialize(llvm::Deserializer& D) { case IfStmtClass: return IfStmt::directMaterialize(D); + case IndirectGotoStmtClass: + return IndirectGotoStmt::directMaterialize(D); + case IntegerLiteralClass: return IntegerLiteral::directMaterialize(D); @@ -256,6 +259,16 @@ IfStmt* IfStmt::directMaterialize(llvm::Deserializer& D) { return new IfStmt(L,Cond,Then,Else); } +void IndirectGotoStmt::directEmit(llvm::Serializer& S) const { + S.EmitPtr(Target); +} + +IndirectGotoStmt* IndirectGotoStmt::directMaterialize(llvm::Deserializer& D) { + IndirectGotoStmt* stmt = new IndirectGotoStmt(NULL); + D.ReadPtr(stmt->Target); // The target may be backpatched. + return stmt; +} + void IntegerLiteral::directEmit(llvm::Serializer& S) const { S.Emit(Loc); S.Emit(getType()); diff --git a/clang/include/clang/AST/Stmt.h b/clang/include/clang/AST/Stmt.h index e35ca4671e3e..a7cfab0c8353 100644 --- a/clang/include/clang/AST/Stmt.h +++ b/clang/include/clang/AST/Stmt.h @@ -602,6 +602,8 @@ public: /// class IndirectGotoStmt : public Stmt { Expr *Target; + // FIXME: Add location information (e.g. SourceLocation objects). + // When doing so, update the serialization routines. public: IndirectGotoStmt(Expr *target) : Stmt(IndirectGotoStmtClass), Target(target){} @@ -618,6 +620,9 @@ public: // Iterators virtual child_iterator child_begin(); virtual child_iterator child_end(); + + virtual void directEmit(llvm::Serializer& S) const; + static IndirectGotoStmt* directMaterialize(llvm::Deserializer& D); };