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

Ted Kremenek kremenek at apple.com
Tue Nov 13 16:17:26 PST 2007


Author: kremenek
Date: Tue Nov 13 18:17:21 2007
New Revision: 44091

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

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=44091&r1=44090&r2=44091&view=diff

==============================================================================
--- cfe/trunk/AST/TypeSerialization.cpp (original)
+++ cfe/trunk/AST/TypeSerialization.cpp Tue Nov 13 18:17:21 2007
@@ -70,6 +70,9 @@
       D.RegisterPtr(PtrID,ComplexType::CreateImpl(Context,D));
       break;
       
+    case Type::ConstantArray:
+      D.RegisterPtr(PtrID,ConstantArrayType::CreateImpl(Context,D));
+      
     case Type::FunctionProto:
       D.RegisterPtr(PtrID,FunctionTypeProto::CreateImpl(Context,D));
       break;
@@ -97,6 +100,28 @@
 }
 
 //===----------------------------------------------------------------------===//
+// ConstantArray
+//===----------------------------------------------------------------------===//
+
+void ConstantArrayType::EmitImpl(Serializer& S) const {
+  S.Emit(getElementType());
+  S.EmitInt(getSizeModifier());
+  S.EmitInt(getIndexTypeQualifier());
+  S.Emit(Size);
+}
+
+Type* ConstantArrayType::CreateImpl(ASTContext& Context, Deserializer& D) {
+  QualType ElTy = QualType::ReadVal(D);
+  ArraySizeModifier am = static_cast<ArraySizeModifier>(D.ReadInt());
+  unsigned ITQ = D.ReadInt();
+
+  llvm::APInt Size;
+  D.Read(Size);
+
+  return Context.getConstantArrayType(ElTy,Size,am,ITQ).getTypePtr();
+}
+
+//===----------------------------------------------------------------------===//
 // FunctionTypeProto
 //===----------------------------------------------------------------------===//
 

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

==============================================================================
--- cfe/trunk/include/clang/AST/Type.h (original)
+++ cfe/trunk/include/clang/AST/Type.h Tue Nov 13 18:17:21 2007
@@ -560,6 +560,11 @@
     return T->getTypeClass() == ConstantArray; 
   }
   static bool classof(const ConstantArrayType *) { return true; }
+  
+protected:  
+  virtual void EmitImpl(llvm::Serializer& S) const;
+  static Type* CreateImpl(ASTContext& Context, llvm::Deserializer& D);
+  friend class Type;
 };
 
 // FIXME: VariableArrayType's aren't uniqued (since expressions aren't).





More information about the cfe-commits mailing list