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

Ted Kremenek kremenek at apple.com
Sat Jul 26 20:47:55 PDT 2008


Author: kremenek
Date: Sat Jul 26 22:47:53 2008
New Revision: 54117

URL: http://llvm.org/viewvc/llvm-project?rev=54117&view=rev
Log:
Fix serialization for TypedefType by allowing TypedefType to access the internal CanonicalType stored in Type.
The test case Serialization/stmt_exprs.c now passes.

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

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

==============================================================================
--- cfe/trunk/include/clang/AST/Type.h (original)
+++ cfe/trunk/include/clang/AST/Type.h Sat Jul 26 22:47:53 2008
@@ -394,6 +394,7 @@
 private:  
   QualType getCanonicalTypeInternal() const { return CanonicalType; }
   friend class QualType;
+  friend class TypedefType;
 public:
   void dump() const;
   virtual void getAsStringInternal(std::string &InnerString) const = 0;

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

==============================================================================
--- cfe/trunk/lib/AST/TypeSerialization.cpp (original)
+++ cfe/trunk/lib/AST/TypeSerialization.cpp Sat Jul 26 22:47:53 2008
@@ -239,7 +239,7 @@
 //===----------------------------------------------------------------------===//
 
 void TypedefType::EmitImpl(Serializer& S) const {
-  S.Emit(QualType((Type*)this,0)/*.getCanonicalType()*/);
+  S.Emit(getCanonicalTypeInternal());
   S.EmitPtr(Decl);
 }
 
@@ -247,7 +247,7 @@
   std::vector<Type*>& Types = 
     const_cast<std::vector<Type*>&>(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.





More information about the cfe-commits mailing list