Add serialization support for TypeOfExpr.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@61416 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/include/clang/AST/Type.h b/include/clang/AST/Type.h
index 60ae34b..e272dc9 100644
--- a/include/clang/AST/Type.h
+++ b/include/clang/AST/Type.h
@@ -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).
diff --git a/lib/AST/TypeSerialization.cpp b/lib/AST/TypeSerialization.cpp
index 8e35f18..064b5b8 100644
--- a/lib/AST/TypeSerialization.cpp
+++ b/lib/AST/TypeSerialization.cpp
@@ -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