[cfe-commits] r57502 - in /cfe/trunk: include/clang/AST/Expr.h include/clang/AST/ExprObjC.h lib/AST/StmtSerialization.cpp

Daniel Dunbar daniel at zuster.org
Tue Oct 14 09:57:09 PDT 2008


Author: ddunbar
Date: Tue Oct 14 11:57:09 2008
New Revision: 57502

URL: http://llvm.org/viewvc/llvm-project?rev=57502&view=rev
Log:
Add serialization support in several missing places.

Modified:
    cfe/trunk/include/clang/AST/Expr.h
    cfe/trunk/include/clang/AST/ExprObjC.h
    cfe/trunk/lib/AST/StmtSerialization.cpp

Modified: cfe/trunk/include/clang/AST/Expr.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/AST/Expr.h?rev=57502&r1=57501&r2=57502&view=diff

==============================================================================
--- cfe/trunk/include/clang/AST/Expr.h (original)
+++ cfe/trunk/include/clang/AST/Expr.h Tue Oct 14 11:57:09 2008
@@ -1150,6 +1150,9 @@
   // Iterators
   virtual child_iterator child_begin();
   virtual child_iterator child_end();
+
+  virtual void EmitImpl(llvm::Serializer& S) const;
+  static TypesCompatibleExpr* CreateImpl(llvm::Deserializer& D, ASTContext& C);
 };
 
 /// ShuffleVectorExpr - clang-specific builtin-in function
@@ -1215,6 +1218,9 @@
   // Iterators
   virtual child_iterator child_begin();
   virtual child_iterator child_end();
+
+  virtual void EmitImpl(llvm::Serializer& S) const;
+  static ShuffleVectorExpr* CreateImpl(llvm::Deserializer& D, ASTContext& C);
 };
 
 /// ChooseExpr - GNU builtin-in function __builtin_choose_expr.
@@ -1256,6 +1262,9 @@
   // Iterators
   virtual child_iterator child_begin();
   virtual child_iterator child_end();
+
+  virtual void EmitImpl(llvm::Serializer& S) const;
+  static ChooseExpr* CreateImpl(llvm::Deserializer& D, ASTContext& C);
 };
 
 /// OverloadExpr - Clang builtin function __builtin_overload.
@@ -1370,6 +1379,9 @@
   // Iterators
   virtual child_iterator child_begin();
   virtual child_iterator child_end();  
+
+  virtual void EmitImpl(llvm::Serializer& S) const;
+  static VAArgExpr* CreateImpl(llvm::Deserializer& D, ASTContext& C);
 };
   
 /// InitListExpr - used for struct and array initializers, such as:
@@ -1496,6 +1508,9 @@
   // Iterators
   virtual child_iterator child_begin();
   virtual child_iterator child_end();
+
+  virtual void EmitImpl(llvm::Serializer& S) const;
+  static ExtVectorElementExpr* CreateImpl(llvm::Deserializer& D, ASTContext& C);
 };
 
 

Modified: cfe/trunk/include/clang/AST/ExprObjC.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/AST/ExprObjC.h?rev=57502&r1=57501&r2=57502&view=diff

==============================================================================
--- cfe/trunk/include/clang/AST/ExprObjC.h (original)
+++ cfe/trunk/include/clang/AST/ExprObjC.h Tue Oct 14 11:57:09 2008
@@ -148,6 +148,9 @@
   // Iterators
   virtual child_iterator child_begin();
   virtual child_iterator child_end();
+
+  virtual void EmitImpl(llvm::Serializer& S) const;
+  static ObjCProtocolExpr* CreateImpl(llvm::Deserializer& D, ASTContext& C);
 };
 
 /// ObjCIvarRefExpr - A reference to an ObjC instance variable.

Modified: cfe/trunk/lib/AST/StmtSerialization.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/AST/StmtSerialization.cpp?rev=57502&r1=57501&r2=57502&view=diff

==============================================================================
--- cfe/trunk/lib/AST/StmtSerialization.cpp (original)
+++ cfe/trunk/lib/AST/StmtSerialization.cpp Tue Oct 14 11:57:09 2008
@@ -804,6 +804,80 @@
   return new StmtExpr(SubStmt,t,L,R);
 }
 
+void TypesCompatibleExpr::EmitImpl(llvm::Serializer& S) const {
+  S.Emit(getType());
+  S.Emit(BuiltinLoc);
+  S.Emit(RParenLoc);
+  S.Emit(Type1);
+  S.Emit(Type2);
+}
+
+TypesCompatibleExpr* TypesCompatibleExpr::CreateImpl(llvm::Deserializer& D, 
+                                                     ASTContext& C) {
+  QualType RT = QualType::ReadVal(D);
+  SourceLocation BL = SourceLocation::ReadVal(D);
+  SourceLocation RP = SourceLocation::ReadVal(D);
+  QualType T1 = QualType::ReadVal(D);
+  QualType T2 = QualType::ReadVal(D);
+  return new TypesCompatibleExpr(RT, BL, T1, T2, RP);
+}
+
+void ShuffleVectorExpr::EmitImpl(llvm::Serializer& S) const {
+  S.Emit(getType());
+  S.Emit(BuiltinLoc);
+  S.Emit(RParenLoc);
+  S.EmitInt(NumExprs);
+  for (unsigned i = 0; i < NumExprs; ++i)
+    S.EmitOwnedPtr(getExpr(i));
+}
+
+ShuffleVectorExpr* ShuffleVectorExpr::CreateImpl(llvm::Deserializer& D, 
+                                                 ASTContext& C) {
+  QualType T = QualType::ReadVal(D);
+  SourceLocation BL = SourceLocation::ReadVal(D);
+  SourceLocation RP = SourceLocation::ReadVal(D);
+  unsigned NumExprs = D.ReadInt();
+  llvm::SmallVector<Expr*, 4> Exprs(NumExprs);
+  for (unsigned i = 0; i < NumExprs; ++i)
+    Exprs[i] = D.ReadOwnedPtr<Expr>(C);
+
+  return new ShuffleVectorExpr(Exprs.begin(), NumExprs, T, BL, RP);
+}
+
+void ChooseExpr::EmitImpl(llvm::Serializer& S) const {
+  S.Emit(getType());
+  S.Emit(BuiltinLoc);
+  S.Emit(RParenLoc);
+  S.EmitOwnedPtr(getCond());
+  S.EmitOwnedPtr(getLHS());
+  S.EmitOwnedPtr(getRHS());
+}
+
+ChooseExpr* ChooseExpr::CreateImpl(llvm::Deserializer& D, ASTContext& C) {
+  QualType T = QualType::ReadVal(D);
+  SourceLocation BL = SourceLocation::ReadVal(D);
+  SourceLocation RP = SourceLocation::ReadVal(D);
+  Expr *Cond = D.ReadOwnedPtr<Expr>(C);
+  Expr *LHS = D.ReadOwnedPtr<Expr>(C);
+  Expr *RHS = D.ReadOwnedPtr<Expr>(C);
+  return new ChooseExpr(BL, Cond, LHS, RHS, T, RP);
+}
+
+void VAArgExpr::EmitImpl(llvm::Serializer& S) const {
+  S.Emit(getType());
+  S.Emit(BuiltinLoc);
+  S.Emit(RParenLoc);
+  S.EmitOwnedPtr(getSubExpr());
+}
+
+VAArgExpr* VAArgExpr::CreateImpl(llvm::Deserializer& D, ASTContext& C) {
+  QualType T = QualType::ReadVal(D);
+  SourceLocation BL = SourceLocation::ReadVal(D);
+  SourceLocation RP = SourceLocation::ReadVal(D);
+  Expr *E = D.ReadOwnedPtr<Expr>(C);
+  return new VAArgExpr(BL, E, T, RP);
+}
+
 void StringLiteral::EmitImpl(Serializer& S) const {
   S.Emit(getType());
   S.Emit(firstTokLoc);
@@ -981,6 +1055,22 @@
   return new ObjCForCollectionStmt(Element,Collection,Body,ForLoc, RParenLoc);
 }
 
+void ObjCProtocolExpr::EmitImpl(llvm::Serializer& S) const {
+  S.Emit(getType());
+  S.EmitPtr(Protocol);
+  S.Emit(AtLoc);
+  S.Emit(RParenLoc);
+}
+
+ObjCProtocolExpr* ObjCProtocolExpr::CreateImpl(llvm::Deserializer& D, 
+                                               ASTContext& C) {
+  QualType T = QualType::ReadVal(D);
+  ObjCProtocolDecl *PD = D.ReadPtr<ObjCProtocolDecl>();
+  SourceLocation AL = SourceLocation::ReadVal(D);
+  SourceLocation RP = SourceLocation::ReadVal(D);
+  return new ObjCProtocolExpr(T, PD, AL, RP);
+}
+
 void ObjCIvarRefExpr::EmitImpl(Serializer& S) const {
   S.Emit(Loc);
   S.Emit(getType());
@@ -1112,6 +1202,21 @@
 //   Serialization for Clang Extensions.
 //===----------------------------------------------------------------------===//
 
+void ExtVectorElementExpr::EmitImpl(llvm::Serializer& S) const {
+  S.Emit(getType());
+  S.EmitOwnedPtr(getBase());
+  S.EmitPtr(&Accessor);
+  S.Emit(AccessorLoc);
+}
+
+ExtVectorElementExpr* CreateImpl(llvm::Deserializer& D, ASTContext& C) {
+  QualType T = QualType::ReadVal(D);
+  Expr *B = D.ReadOwnedPtr<Expr>(C);
+  IdentifierInfo *A = D.ReadPtr<IdentifierInfo>();
+  SourceLocation AL = SourceLocation::ReadVal(D);
+  return new ExtVectorElementExpr(T, B, *A, AL);
+}
+
 void BlockExpr::EmitImpl(Serializer& S) const {
   S.Emit(getType());
   S.EmitOwnedPtr(TheBlock);





More information about the cfe-commits mailing list