[cfe-commits] r44090 - in /cfe/trunk: AST/TypeSerialization.cpp include/clang/AST/Type.h

Ted Kremenek kremenek at apple.com
Tue Nov 13 16:03:59 PST 2007


Author: kremenek
Date: Tue Nov 13 18:03:56 2007
New Revision: 44090

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

Modified:
    cfe/trunk/AST/TypeSerialization.cpp
    cfe/trunk/include/clang/AST/Type.h

Modified: cfe/trunk/AST/TypeSerialization.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/AST/TypeSerialization.cpp?rev=44090&r1=44089&r2=44090&view=diff

==============================================================================
--- cfe/trunk/AST/TypeSerialization.cpp (original)
+++ cfe/trunk/AST/TypeSerialization.cpp Tue Nov 13 18:03:56 2007
@@ -76,7 +76,11 @@
       
     case Type::Pointer:
       D.RegisterPtr(PtrID,PointerType::CreateImpl(Context,D));
-      break;      
+      break;
+      
+    case Type::Tagged:
+      D.RegisterPtr(PtrID,TagType::CreateImpl(Context,D));
+      break;
   }
 }
 
@@ -130,3 +134,17 @@
 Type* PointerType::CreateImpl(ASTContext& Context, Deserializer& D) {
   return Context.getPointerType(QualType::ReadVal(D)).getTypePtr();
 }
+
+//===----------------------------------------------------------------------===//
+// TagType
+//===----------------------------------------------------------------------===//
+
+void TagType::EmitImpl(Serializer& S) const {
+  S.EmitPtr(Decl);
+}
+
+Type* TagType::CreateImpl(ASTContext& Context, Deserializer& D) {
+  TagType* T = cast<TagType>(Context.getTagDeclType(NULL).getTypePtr());
+  D.ReadPtr(T->Decl); // May be backpatched.  
+  return T;
+}

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

==============================================================================
--- cfe/trunk/include/clang/AST/Type.h (original)
+++ cfe/trunk/include/clang/AST/Type.h Tue Nov 13 18:03:56 2007
@@ -865,6 +865,11 @@
   
   static bool classof(const Type *T) { return T->getTypeClass() == Tagged; }
   static bool classof(const TagType *) { return true; }
+  
+protected:  
+  virtual void EmitImpl(llvm::Serializer& S) const;
+  static Type* CreateImpl(ASTContext& Context, llvm::Deserializer& D);
+  friend class Type;
 };
 
 class ObjcInterfaceType : public Type {





More information about the cfe-commits mailing list