From b28166d11e788bc99fd5cd47c4f649ea0195c3b1 Mon Sep 17 00:00:00 2001 From: Ted Kremenek Date: Wed, 14 Nov 2007 00:27:46 +0000 Subject: [PATCH] Implemented serialization of TypedefType. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@44092 91177308-0d34-0410-b5e6-96231b3b80d8 --- AST/TypeSerialization.cpp | 26 ++++++++++++++++++++++++++ include/clang/AST/Type.h | 5 +++++ 2 files changed, 31 insertions(+) diff --git a/AST/TypeSerialization.cpp b/AST/TypeSerialization.cpp index 93b2ce3271..06c907a865 100644 --- a/AST/TypeSerialization.cpp +++ b/AST/TypeSerialization.cpp @@ -84,6 +84,10 @@ void Type::Create(ASTContext& Context, unsigned i, Deserializer& D) { case Type::Tagged: D.RegisterPtr(PtrID,TagType::CreateImpl(Context,D)); break; + + case Type::TypeName: + D.RegisterPtr(PtrID,TypedefType::CreateImpl(Context,D)); + break; } } @@ -173,3 +177,25 @@ Type* TagType::CreateImpl(ASTContext& Context, Deserializer& D) { D.ReadPtr(T->Decl); // May be backpatched. return T; } + +//===----------------------------------------------------------------------===// +// TypedefType +//===----------------------------------------------------------------------===// + +void TypedefType::EmitImpl(Serializer& S) const { + S.Emit(QualType((Type*)this,0).getCanonicalType()); + S.EmitPtr(Decl); +} + +Type* TypedefType::CreateImpl(ASTContext& Context, Deserializer& D) { + std::vector& Types = + const_cast&>(Context.getTypes()); + + TypedefType* T = new TypedefType(NULL,QualType::ReadVal(D)); + Types.push_back(T); + + D.ReadPtr(T->Decl); // May be backpatched. + + return T; +} + diff --git a/include/clang/AST/Type.h b/include/clang/AST/Type.h index 7c55883fc6..08ab146c07 100644 --- a/include/clang/AST/Type.h +++ b/include/clang/AST/Type.h @@ -824,6 +824,11 @@ public: static bool classof(const Type *T) { return T->getTypeClass() == TypeName; } static bool classof(const TypedefType *) { return true; } + +protected: + virtual void EmitImpl(llvm::Serializer& S) const; + static Type* CreateImpl(ASTContext& Context,llvm::Deserializer& D); + friend class Type; }; /// TypeOfExpr (GCC extension). -- 2.50.1