Implemented serialization for ObjcAtFinallyStmt.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@44564 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/AST/StmtSerialization.cpp b/AST/StmtSerialization.cpp
index ea136bf..a32e5b9 100644
--- a/AST/StmtSerialization.cpp
+++ b/AST/StmtSerialization.cpp
@@ -159,6 +159,9 @@
case ObjcAtCatchStmtClass:
return ObjcAtCatchStmt::CreateImpl(D);
+ case ObjcAtFinallyStmtClass:
+ return ObjcAtFinallyStmt::CreateImpl(D);
+
case ObjCIvarRefExprClass:
return ObjCIvarRefExpr::CreateImpl(D);
}
@@ -847,6 +850,17 @@
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<Stmt>();
+ 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 c95e8a1..0cfc5c3 100644
--- a/include/clang/AST/Stmt.h
+++ b/include/clang/AST/Stmt.h
@@ -833,30 +833,30 @@
/// 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