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

Ted Kremenek kremenek at apple.com
Wed Nov 7 16:41:37 PST 2007


Author: kremenek
Date: Wed Nov  7 18:41:37 2007
New Revision: 43860

URL: http://llvm.org/viewvc/llvm-project?rev=43860&view=rev
Log:
Implemented serialization of CompoundAssignOperator.

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

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

==============================================================================
--- cfe/trunk/AST/StmtSerialization.cpp (original)
+++ cfe/trunk/AST/StmtSerialization.cpp Wed Nov  7 18:41:37 2007
@@ -56,6 +56,9 @@
     case CharacterLiteralClass:
       return CharacterLiteral::directMaterialize(D);
       
+    case CompoundAssignOperatorClass:
+      return CompoundAssignOperator::directMaterialize(D);
+      
     case CompoundStmtClass:
       return CompoundStmt::directMaterialize(D);
       
@@ -228,6 +231,26 @@
   return new CharacterLiteral(value,T,Loc);
 }
 
+void CompoundAssignOperator::directEmit(Serializer& S) const {
+  S.Emit(getType());
+  S.Emit(ComputationType);
+  S.Emit(getOperatorLoc());
+  S.EmitInt(getOpcode());
+  S.BatchEmitOwnedPtrs(getLHS(),getRHS());
+}
+
+CompoundAssignOperator* 
+CompoundAssignOperator::directMaterialize(Deserializer& D) {
+  QualType t = QualType::ReadVal(D);
+  QualType c = QualType::ReadVal(D);
+  SourceLocation L = SourceLocation::ReadVal(D);
+  Opcode Opc = static_cast<Opcode>(D.ReadInt());
+  Expr* LHS, *RHS;
+  D.BatchReadOwnedPtrs(LHS,RHS);
+  
+  return new CompoundAssignOperator(LHS,RHS,Opc,t,c,L);
+}
+
 void CompoundStmt::directEmit(Serializer& S) const {
   S.Emit(LBracLoc);
   S.Emit(RBracLoc);

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

==============================================================================
--- cfe/trunk/include/clang/AST/Expr.h (original)
+++ cfe/trunk/include/clang/AST/Expr.h Wed Nov  7 18:41:37 2007
@@ -878,6 +878,9 @@
   static bool classof(const Stmt *S) { 
     return S->getStmtClass() == CompoundAssignOperatorClass; 
   }
+  
+  virtual void directEmit(llvm::Serializer& S) const;
+  static CompoundAssignOperator* directMaterialize(llvm::Deserializer& D);
 };
 
 /// ConditionalOperator - The ?: operator.  Note that LHS may be null when the





More information about the cfe-commits mailing list