]> granicus.if.org Git - clang/commitdiff
Implemented serialization for ObjcAtCatchStmt.
authorTed Kremenek <kremenek@apple.com>
Tue, 4 Dec 2007 00:28:54 +0000 (00:28 +0000)
committerTed Kremenek <kremenek@apple.com>
Tue, 4 Dec 2007 00:28:54 +0000 (00:28 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@44563 91177308-0d34-0410-b5e6-96231b3b80d8

AST/StmtSerialization.cpp
include/clang/AST/Stmt.h

index 120b68e5c5ca5edc1aae66e49d653fc5495a35e0..ea136bf9ca0c895f311715d23a1867882601ce10 100644 (file)
@@ -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());
index 3865bdd01d4ece11c2a2e8f317421a738cb71b26..c95e8a13d2199042b76d3fa357fb7627a7df9d96 100644 (file)
@@ -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