[cfe-commits] r44093 - in /cfe/trunk: AST/TypeSerialization.cpp include/clang/AST/Type.h
Ted Kremenek
kremenek at apple.com
Tue Nov 13 16:31:36 PST 2007
Author: kremenek
Date: Tue Nov 13 18:31:36 2007
New Revision: 44093
URL: http://llvm.org/viewvc/llvm-project?rev=44093&view=rev
Log:
Implemented serialization of VariableArrayTypes.
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=44093&r1=44092&r2=44093&view=diff
==============================================================================
--- cfe/trunk/AST/TypeSerialization.cpp (original)
+++ cfe/trunk/AST/TypeSerialization.cpp Tue Nov 13 18:31:36 2007
@@ -88,6 +88,10 @@
case Type::TypeName:
D.RegisterPtr(PtrID,TypedefType::CreateImpl(Context,D));
break;
+
+ case Type::VariableArray:
+ D.RegisterPtr(PtrID,VariableArrayType::CreateImpl(Context,D));
+ break;
}
}
@@ -199,3 +203,22 @@
return T;
}
+//===----------------------------------------------------------------------===//
+// VariableArrayType
+//===----------------------------------------------------------------------===//
+
+void VariableArrayType::EmitImpl(Serializer& S) const {
+ S.Emit(getElementType());
+ S.EmitInt(getSizeModifier());
+ S.EmitInt(getIndexTypeQualifier());
+ S.EmitOwnedPtr(SizeExpr);
+}
+
+Type* VariableArrayType::CreateImpl(ASTContext& Context, Deserializer& D) {
+ QualType ElTy = QualType::ReadVal(D);
+ ArraySizeModifier am = static_cast<ArraySizeModifier>(D.ReadInt());
+ unsigned ITQ = D.ReadInt();
+ Expr* SizeExpr = D.ReadOwnedPtr<Expr>();
+
+ return Context.getVariableArrayType(ElTy,SizeExpr,am,ITQ).getTypePtr();
+}
Modified: cfe/trunk/include/clang/AST/Type.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/AST/Type.h?rev=44093&r1=44092&r2=44093&view=diff
==============================================================================
--- cfe/trunk/include/clang/AST/Type.h (original)
+++ cfe/trunk/include/clang/AST/Type.h Tue Nov 13 18:31:36 2007
@@ -599,6 +599,11 @@
static void Profile(llvm::FoldingSetNodeID &ID, QualType ET) {
ID.AddPointer(ET.getAsOpaquePtr());
}
+
+protected:
+ virtual void EmitImpl(llvm::Serializer& S) const;
+ static Type* CreateImpl(ASTContext& Context,llvm::Deserializer& D);
+ friend class Type;
};
/// VectorType - GCC generic vector type. This type is created using
More information about the cfe-commits
mailing list