From: Ted Kremenek Date: Sun, 27 Jul 2008 03:47:53 +0000 (+0000) Subject: Fix serialization for TypedefType by allowing TypedefType to access the internal... X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=d90700108cfb45f2dda6c5a7adc11ce5ac68aa0d;p=clang Fix serialization for TypedefType by allowing TypedefType to access the internal CanonicalType stored in Type. The test case Serialization/stmt_exprs.c now passes. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@54117 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/include/clang/AST/Type.h b/include/clang/AST/Type.h index 952a5dd9ba..5d764894c2 100644 --- a/include/clang/AST/Type.h +++ b/include/clang/AST/Type.h @@ -394,6 +394,7 @@ public: private: QualType getCanonicalTypeInternal() const { return CanonicalType; } friend class QualType; + friend class TypedefType; public: void dump() const; virtual void getAsStringInternal(std::string &InnerString) const = 0; diff --git a/lib/AST/TypeSerialization.cpp b/lib/AST/TypeSerialization.cpp index 00b71b65b5..60b5c68b0c 100644 --- a/lib/AST/TypeSerialization.cpp +++ b/lib/AST/TypeSerialization.cpp @@ -239,7 +239,7 @@ Type* TagType::CreateImpl(ASTContext& Context, Deserializer& D) { //===----------------------------------------------------------------------===// void TypedefType::EmitImpl(Serializer& S) const { - S.Emit(QualType((Type*)this,0)/*.getCanonicalType()*/); + S.Emit(getCanonicalTypeInternal()); S.EmitPtr(Decl); } @@ -247,7 +247,7 @@ Type* TypedefType::CreateImpl(ASTContext& Context, Deserializer& D) { std::vector& Types = const_cast&>(Context.getTypes()); - TypedefType* T = new TypedefType(Type::TypeName, NULL,QualType::ReadVal(D)); + TypedefType* T = new TypedefType(Type::TypeName, NULL, QualType::ReadVal(D)); Types.push_back(T); D.ReadPtr(T->Decl); // May be backpatched.