From af526779b36f43f59e47cfc5b10bb0c48562f4a9 Mon Sep 17 00:00:00 2001 From: Ted Kremenek Date: Tue, 4 Dec 2007 00:28:54 +0000 Subject: [PATCH] Implemented serialization for ObjcAtCatchStmt. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@44563 91177308-0d34-0410-b5e6-96231b3b80d8 --- AST/StmtSerialization.cpp | 22 ++++++++++++++++++++++ include/clang/AST/Stmt.h | 10 ++++++++-- 2 files changed, 30 insertions(+), 2 deletions(-) diff --git a/AST/StmtSerialization.cpp b/AST/StmtSerialization.cpp index 120b68e5c5..ea136bf9ca 100644 --- a/AST/StmtSerialization.cpp +++ b/AST/StmtSerialization.cpp @@ -155,6 +155,9 @@ Stmt* Stmt::Create(Deserializer& D) { //==--------------------------------------==// // Objective C //==--------------------------------------==// + + case ObjcAtCatchStmtClass: + return ObjcAtCatchStmt::CreateImpl(D); case ObjCIvarRefExprClass: return ObjCIvarRefExpr::CreateImpl(D); @@ -825,6 +828,25 @@ WhileStmt* WhileStmt::CreateImpl(Deserializer& D) { // Objective C Serialization //===----------------------------------------------------------------------===// +void ObjcAtCatchStmt::EmitImpl(Serializer& S) const { + S.Emit(AtCatchLoc); + S.Emit(RParenLoc); + S.EmitPtr(NextAtCatchStmt); + S.BatchEmitOwnedPtrs((unsigned) END_EXPR,&SubExprs[0]); +} + +ObjcAtCatchStmt* ObjcAtCatchStmt::CreateImpl(Deserializer& D) { + SourceLocation AtCatchLoc = SourceLocation::ReadVal(D); + SourceLocation RParenLoc = SourceLocation::ReadVal(D); + + ObjcAtCatchStmt* stmt = new ObjcAtCatchStmt(AtCatchLoc,RParenLoc); + + D.ReadPtr(stmt->NextAtCatchStmt); // Allows backpatching. + D.BatchReadOwnedPtrs((unsigned) END_EXPR, &stmt->SubExprs[0]); + + return stmt; +} + void ObjCIvarRefExpr::EmitImpl(Serializer& S) const { S.Emit(Loc); S.Emit(getType()); diff --git a/include/clang/AST/Stmt.h b/include/clang/AST/Stmt.h index 3865bdd01d..c95e8a13d2 100644 --- a/include/clang/AST/Stmt.h +++ b/include/clang/AST/Stmt.h @@ -782,7 +782,11 @@ private: enum { SELECTOR, BODY, END_EXPR }; Stmt *SubExprs[END_EXPR]; SourceLocation AtCatchLoc, RParenLoc; - + + // Used by deserialization. + ObjcAtCatchStmt(SourceLocation atCatchLoc, SourceLocation rparenloc) + : Stmt(ObjcAtCatchStmtClass), AtCatchLoc(atCatchLoc), RParenLoc(rparenloc) {} + public: ObjcAtCatchStmt(SourceLocation atCatchLoc, SourceLocation rparenloc, Stmt *catchVarStmtDecl, Stmt *atCatchStmt, Stmt *atCatchList) @@ -822,7 +826,9 @@ public: virtual child_iterator child_begin(); virtual child_iterator child_end(); - + + virtual void EmitImpl(llvm::Serializer& S) const; + static ObjcAtCatchStmt* CreateImpl(llvm::Deserializer& D); }; /// ObjcAtFinallyStmt - This represent objective-c's @finally Statement -- 2.50.1