From 3f0767b74b16b37bcce60ff457609161a0665784 Mon Sep 17 00:00:00 2001 From: Ted Kremenek Date: Wed, 7 Nov 2007 08:07:46 +0000 Subject: [PATCH] Implemented serialization of GotoStmt. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@43818 91177308-0d34-0410-b5e6-96231b3b80d8 --- AST/StmtSerialization.cpp | 17 +++++++++++++++++ include/clang/AST/Stmt.h | 3 +++ 2 files changed, 20 insertions(+) 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. -- 2.40.0