[cfe-commits] r61417 - in /cfe/trunk: include/clang/AST/Type.h lib/AST/TypeSerialization.cpp
Zhongxing Xu
xuzhongxing at gmail.com
Tue Dec 23 23:22:27 PST 2008
Author: zhongxingxu
Date: Wed Dec 24 01:22:26 2008
New Revision: 61417
URL: http://llvm.org/viewvc/llvm-project?rev=61417&view=rev
Log:
Add serialization support for TypeOfType.
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=61417&r1=61416&r2=61417&view=diff
==============================================================================
--- cfe/trunk/include/clang/AST/Type.h (original)
+++ cfe/trunk/include/clang/AST/Type.h Wed Dec 24 01:22:26 2008
@@ -1183,6 +1183,11 @@
static bool classof(const Type *T) { return T->getTypeClass() == TypeOfTyp; }
static bool classof(const TypeOfType *) { return true; }
+
+protected:
+ virtual void EmitImpl(llvm::Serializer& S) const;
+ static Type* CreateImpl(ASTContext& Context, llvm::Deserializer& D);
+ friend class Type;
};
class TagType : public Type {
Modified: cfe/trunk/lib/AST/TypeSerialization.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/AST/TypeSerialization.cpp?rev=61417&r1=61416&r2=61417&view=diff
==============================================================================
--- cfe/trunk/lib/AST/TypeSerialization.cpp (original)
+++ cfe/trunk/lib/AST/TypeSerialization.cpp Wed Dec 24 01:22:26 2008
@@ -113,7 +113,11 @@
case Type::TypeOfExp:
D.RegisterPtr(PtrID, TypeOfExpr::CreateImpl(Context, D));
break;
-
+
+ case Type::TypeOfTyp:
+ D.RegisterPtr(PtrID, TypeOfType::CreateImpl(Context, D));
+ break;
+
case Type::TemplateTypeParm:
D.RegisterPtr(PtrID,TemplateTypeParmType::CreateImpl(Context, D));
break;
@@ -282,6 +286,7 @@
//===----------------------------------------------------------------------===//
// TypeOfExpr
//===----------------------------------------------------------------------===//
+
void TypeOfExpr::EmitImpl(llvm::Serializer& S) const {
S.EmitOwnedPtr(TOExpr);
}
@@ -297,6 +302,26 @@
return T;
}
+
+//===----------------------------------------------------------------------===//
+// TypeOfType
+//===----------------------------------------------------------------------===//
+
+void TypeOfType::EmitImpl(llvm::Serializer& S) const {
+ S.Emit(TOType);
+}
+
+Type* TypeOfType::CreateImpl(ASTContext& Context, Deserializer& D) {
+ QualType TOType = QualType::ReadVal(D);
+
+ std::vector<Type*>& Types =
+ const_cast<std::vector<Type*>&>(Context.getTypes());
+
+ TypeOfType* T = new TypeOfType(TOType, Context.getCanonicalType(TOType));
+ Types.push_back(T);
+
+ return T;
+}
//===----------------------------------------------------------------------===//
// TemplateTypeParmType
More information about the cfe-commits
mailing list