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

Ted Kremenek kremenek at apple.com
Wed Nov 7 09:02:32 PST 2007


Author: kremenek
Date: Wed Nov  7 11:02:32 2007
New Revision: 43821

URL: http://llvm.org/viewvc/llvm-project?rev=43821&view=rev
Log:
Implemented serialization of IndirectGotoStmt.
Added "FIXME" regarding the lack of source location information for IndirectGotoStmt.

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

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

==============================================================================
--- cfe/trunk/AST/StmtSerialization.cpp (original)
+++ cfe/trunk/AST/StmtSerialization.cpp Wed Nov  7 11:02:32 2007
@@ -64,6 +64,9 @@
     case IfStmtClass:
       return IfStmt::directMaterialize(D);
       
+    case IndirectGotoStmtClass:
+      return IndirectGotoStmt::directMaterialize(D);      
+      
     case IntegerLiteralClass:
       return IntegerLiteral::directMaterialize(D);
       
@@ -256,6 +259,16 @@
   return new IfStmt(L,Cond,Then,Else);
 }
 
+void IndirectGotoStmt::directEmit(llvm::Serializer& S) const {
+  S.EmitPtr(Target);  
+}
+
+IndirectGotoStmt* IndirectGotoStmt::directMaterialize(llvm::Deserializer& D) {
+  IndirectGotoStmt* stmt = new IndirectGotoStmt(NULL);
+  D.ReadPtr(stmt->Target); // The target may be backpatched.
+  return stmt;
+}
+
 void IntegerLiteral::directEmit(llvm::Serializer& S) const {
   S.Emit(Loc);
   S.Emit(getType());

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

==============================================================================
--- cfe/trunk/include/clang/AST/Stmt.h (original)
+++ cfe/trunk/include/clang/AST/Stmt.h Wed Nov  7 11:02:32 2007
@@ -602,6 +602,8 @@
 ///
 class IndirectGotoStmt : public Stmt {
   Expr *Target;
+  // FIXME: Add location information (e.g. SourceLocation objects).
+  //        When doing so, update the serialization routines.
 public:
   IndirectGotoStmt(Expr *target) : Stmt(IndirectGotoStmtClass), Target(target){}
   
@@ -618,6 +620,9 @@
   // Iterators
   virtual child_iterator child_begin();
   virtual child_iterator child_end();
+  
+  virtual void directEmit(llvm::Serializer& S) const;
+  static IndirectGotoStmt* directMaterialize(llvm::Deserializer& D);
 };
 
 





More information about the cfe-commits mailing list