[cfe-commits] r61416 - in /cfe/trunk: include/clang/AST/Type.h lib/AST/TypeSerialization.cpp
Zhongxing Xu
xuzhongxing at gmail.com
Tue Dec 23 22:36:02 PST 2008
Author: zhongxingxu
Date: Wed Dec 24 00:36:01 2008
New Revision: 61416
URL: http://llvm.org/viewvc/llvm-project?rev=61416&view=rev
Log:
Add serialization support for TypeOfExpr.
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=61416&r1=61415&r2=61416&view=diff
==============================================================================
--- cfe/trunk/include/clang/AST/Type.h (original)
+++ cfe/trunk/include/clang/AST/Type.h Wed Dec 24 00:36:01 2008
@@ -1161,6 +1161,11 @@
static bool classof(const Type *T) { return T->getTypeClass() == TypeOfExp; }
static bool classof(const TypeOfExpr *) { return true; }
+
+protected:
+ virtual void EmitImpl(llvm::Serializer& S) const;
+ static Type* CreateImpl(ASTContext& Context, llvm::Deserializer& D);
+ friend class Type;
};
/// TypeOfType (GCC extension).
Modified: cfe/trunk/lib/AST/TypeSerialization.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/AST/TypeSerialization.cpp?rev=61416&r1=61415&r2=61416&view=diff
==============================================================================
--- cfe/trunk/lib/AST/TypeSerialization.cpp (original)
+++ cfe/trunk/lib/AST/TypeSerialization.cpp Wed Dec 24 00:36:01 2008
@@ -109,6 +109,10 @@
case Type::TypeName:
D.RegisterPtr(PtrID,TypedefType::CreateImpl(Context,D));
break;
+
+ case Type::TypeOfExp:
+ D.RegisterPtr(PtrID, TypeOfExpr::CreateImpl(Context, D));
+ break;
case Type::TemplateTypeParm:
D.RegisterPtr(PtrID,TemplateTypeParmType::CreateImpl(Context, D));
@@ -274,6 +278,25 @@
D.ReadPtr(T->Decl); // May be backpatched.
return T;
}
+
+//===----------------------------------------------------------------------===//
+// TypeOfExpr
+//===----------------------------------------------------------------------===//
+void TypeOfExpr::EmitImpl(llvm::Serializer& S) const {
+ S.EmitOwnedPtr(TOExpr);
+}
+
+Type* TypeOfExpr::CreateImpl(ASTContext& Context, Deserializer& D) {
+ Expr* E = D.ReadOwnedPtr<Expr>(Context);
+
+ std::vector<Type*>& Types =
+ const_cast<std::vector<Type*>&>(Context.getTypes());
+
+ TypeOfExpr* T = new TypeOfExpr(E, Context.getCanonicalType(E->getType()));
+ Types.push_back(T);
+
+ return T;
+}
//===----------------------------------------------------------------------===//
// TemplateTypeParmType
More information about the cfe-commits
mailing list