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

Ted Kremenek kremenek at apple.com
Wed Nov 7 10:45:55 PST 2007


Author: kremenek
Date: Wed Nov  7 12:45:55 2007
New Revision: 43832

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

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=43832&r1=43831&r2=43832&view=diff

==============================================================================
--- cfe/trunk/AST/StmtSerialization.cpp (original)
+++ cfe/trunk/AST/StmtSerialization.cpp Wed Nov  7 12:45:55 2007
@@ -60,6 +60,9 @@
     
     case DoStmtClass:
       return DoStmt::directMaterialize(D);
+      
+    case FloatingLiteralClass:
+      return FloatingLiteral::directMaterialize(D);
 
     case ForStmtClass:
       return ForStmt::directMaterialize(D);
@@ -244,6 +247,20 @@
   return new DoStmt(Body,Cond,DoLoc);
 }
 
+void FloatingLiteral::directEmit(llvm::Serializer& S) const {
+  S.Emit(Loc);
+  S.Emit(getType());
+  S.Emit(Value);
+}
+
+FloatingLiteral* FloatingLiteral::directMaterialize(llvm::Deserializer& D) {
+  SourceLocation Loc = SourceLocation::ReadVal(D);
+  QualType t = QualType::ReadVal(D);
+  llvm::APFloat Val = llvm::APFloat::ReadVal(D);
+  FloatingLiteral* expr = new FloatingLiteral(Val,t,Loc);
+  return expr;
+}
+
 void ForStmt::directEmit(llvm::Serializer& S) const {
   S.Emit(ForLoc);
   S.EmitOwnedPtr(getInit());

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

==============================================================================
--- cfe/trunk/include/clang/AST/Expr.h (original)
+++ cfe/trunk/include/clang/AST/Expr.h Wed Nov  7 12:45:55 2007
@@ -263,6 +263,9 @@
   // Iterators
   virtual child_iterator child_begin();
   virtual child_iterator child_end();
+  
+  virtual void directEmit(llvm::Serializer& S) const;
+  static FloatingLiteral* directMaterialize(llvm::Deserializer& D);
 };
 
 /// ImaginaryLiteral - We support imaginary integer and floating point literals,





More information about the cfe-commits mailing list