From 04be5aae2dc17292e2007401599638f3c6ba30de Mon Sep 17 00:00:00 2001 From: Ted Kremenek Date: Tue, 4 Dec 2007 00:32:22 +0000 Subject: [PATCH] Implemented serialization for ObjcAtFinallyStmt. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@44564 91177308-0d34-0410-b5e6-96231b3b80d8 --- AST/StmtSerialization.cpp | 14 ++++++++++++ include/clang/AST/Stmt.h | 46 +++++++++++++++++++-------------------- 2 files changed, 37 insertions(+), 23 deletions(-) diff --git a/AST/StmtSerialization.cpp b/AST/StmtSerialization.cpp index ea136bf9ca..a32e5b992b 100644 --- a/AST/StmtSerialization.cpp +++ b/AST/StmtSerialization.cpp @@ -159,6 +159,9 @@ Stmt* Stmt::Create(Deserializer& D) { case ObjcAtCatchStmtClass: return ObjcAtCatchStmt::CreateImpl(D); + case ObjcAtFinallyStmtClass: + return ObjcAtFinallyStmt::CreateImpl(D); + case ObjCIvarRefExprClass: return ObjCIvarRefExpr::CreateImpl(D); } @@ -847,6 +850,17 @@ ObjcAtCatchStmt* ObjcAtCatchStmt::CreateImpl(Deserializer& D) { return stmt; } +void ObjcAtFinallyStmt::EmitImpl(Serializer& S) const { + S.Emit(AtFinallyLoc); + S.EmitOwnedPtr(AtFinallyStmt); +} + +ObjcAtFinallyStmt* ObjcAtFinallyStmt::CreateImpl(Deserializer& D) { + SourceLocation Loc = SourceLocation::ReadVal(D); + Stmt* AtFinallyStmt = D.ReadOwnedPtr(); + return new ObjcAtFinallyStmt(Loc,AtFinallyStmt); +} + 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 c95e8a13d2..0cfc5c3d6b 100644 --- a/include/clang/AST/Stmt.h +++ b/include/clang/AST/Stmt.h @@ -833,30 +833,30 @@ public: /// ObjcAtFinallyStmt - This represent objective-c's @finally Statement class ObjcAtFinallyStmt : public Stmt { - private: - Stmt *AtFinallyStmt; - SourceLocation AtFinallyLoc; - - public: - ObjcAtFinallyStmt(SourceLocation atFinallyLoc, Stmt *atFinallyStmt) - : Stmt(ObjcAtFinallyStmtClass), - AtFinallyStmt(atFinallyStmt), AtFinallyLoc(atFinallyLoc) {} - - const Stmt *getFinallyBody () const { return AtFinallyStmt; } - Stmt *getFinallyBody () { return AtFinallyStmt; } + Stmt *AtFinallyStmt; + SourceLocation AtFinallyLoc; +public: + ObjcAtFinallyStmt(SourceLocation atFinallyLoc, Stmt *atFinallyStmt) + : Stmt(ObjcAtFinallyStmtClass), + AtFinallyStmt(atFinallyStmt), AtFinallyLoc(atFinallyLoc) {} - virtual SourceRange getSourceRange() const { - return SourceRange(AtFinallyLoc, AtFinallyStmt->getLocEnd()); - } - - static bool classof(const Stmt *T) { - return T->getStmtClass() == ObjcAtFinallyStmtClass; - } - static bool classof(const ObjcAtFinallyStmt *) { return true; } - - virtual child_iterator child_begin(); - virtual child_iterator child_end(); - + const Stmt *getFinallyBody () const { return AtFinallyStmt; } + Stmt *getFinallyBody () { return AtFinallyStmt; } + + virtual SourceRange getSourceRange() const { + return SourceRange(AtFinallyLoc, AtFinallyStmt->getLocEnd()); + } + + static bool classof(const Stmt *T) { + return T->getStmtClass() == ObjcAtFinallyStmtClass; + } + static bool classof(const ObjcAtFinallyStmt *) { return true; } + + virtual child_iterator child_begin(); + virtual child_iterator child_end(); + + virtual void EmitImpl(llvm::Serializer& S) const; + static ObjcAtFinallyStmt* CreateImpl(llvm::Deserializer& D); }; /// ObjcAtTryStmt - This represent objective-c's over-all -- 2.40.0