]> granicus.if.org Git - clang/commitdiff
Implemented serialization of InitListExpr.
authorTed Kremenek <kremenek@apple.com>
Wed, 14 Nov 2007 21:31:46 +0000 (21:31 +0000)
committerTed Kremenek <kremenek@apple.com>
Wed, 14 Nov 2007 21:31:46 +0000 (21:31 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@44137 91177308-0d34-0410-b5e6-96231b3b80d8

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

index 2c1205ef7a64d98bd3cf859576953e8f780369b7..d4ddf4c57f9dfbf4bcac8dfcef9b49aa375e5509 100644 (file)
@@ -108,7 +108,10 @@ Stmt* Stmt::Create(Deserializer& D) {
       return ImplicitCastExpr::CreateImpl(D);
       
     case IndirectGotoStmtClass:
-      return IndirectGotoStmt::CreateImpl(D);      
+      return IndirectGotoStmt::CreateImpl(D);
+      
+    case InitListExprClass:
+      return InitListExpr::CreateImpl(D);
       
     case IntegerLiteralClass:
       return IntegerLiteral::CreateImpl(D);
@@ -512,6 +515,24 @@ IndirectGotoStmt* IndirectGotoStmt::CreateImpl(Deserializer& D) {
   return new IndirectGotoStmt(Target);
 }
 
+void InitListExpr::EmitImpl(Serializer& S) const {
+  S.Emit(LBraceLoc);
+  S.Emit(RBraceLoc);
+  S.EmitInt(NumInits);
+  S.BatchEmitOwnedPtrs(NumInits,InitExprs);
+}
+
+InitListExpr* InitListExpr::CreateImpl(Deserializer& D) {
+  InitListExpr* expr = new InitListExpr();
+  expr->LBraceLoc = SourceLocation::ReadVal(D);
+  expr->RBraceLoc = SourceLocation::ReadVal(D);
+  expr->NumInits = D.ReadInt();
+  assert(expr->NumInits);
+  expr->InitExprs = new Expr*[expr->NumInits];
+  D.BatchReadOwnedPtrs(expr->NumInits,expr->InitExprs);
+  return expr;
+}
+
 void IntegerLiteral::EmitImpl(Serializer& S) const {
   S.Emit(Loc);
   S.Emit(getType());
index 6216de7039a0519dc2d7b2d3ebff9949142641e5..7dead68a578f7b053df9d6c31c2ba2059cff6327 100644 (file)
@@ -1126,6 +1126,14 @@ public:
   // Iterators
   virtual child_iterator child_begin();
   virtual child_iterator child_end();
+  
+  virtual void EmitImpl(llvm::Serializer& S) const;
+  static InitListExpr* CreateImpl(llvm::Deserializer& D);
+
+private:
+  // Used by serializer.
+  InitListExpr() : Expr(InitListExprClass, QualType()), 
+                   InitExprs(NULL), NumInits(0) {}
 };
 
 /// ObjCStringLiteral, used for Objective-C string literals