[cfe-commits] r43419 - in /cfe/trunk: AST/TypeSerialization.cpp include/clang/AST/Type.h
Ted Kremenek
kremenek at apple.com
Sat Oct 27 17:59:31 PDT 2007
Author: kremenek
Date: Sat Oct 27 19:59:26 2007
New Revision: 43419
URL: http://llvm.org/viewvc/llvm-project?rev=43419&view=rev
Log:
Implemented serialization of FunctionTypeProto.
Modified:
cfe/trunk/AST/TypeSerialization.cpp
cfe/trunk/include/clang/AST/Type.h
Modified: cfe/trunk/AST/TypeSerialization.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/AST/TypeSerialization.cpp?rev=43419&r1=43418&r2=43419&view=diff
==============================================================================
--- cfe/trunk/AST/TypeSerialization.cpp (original)
+++ cfe/trunk/AST/TypeSerialization.cpp Sat Oct 27 19:59:26 2007
@@ -172,3 +172,34 @@
T->ReadFunctionTypeInternal(D);
return T;
}
+
+void FunctionTypeProto::Emit(llvm::Serializer& S) const {
+ S.EmitInt(NumArgs);
+ EmitFunctionTypeInternal(S);
+
+ for (arg_type_iterator i = arg_type_begin(), e = arg_type_end(); i!=e; ++i)
+ S.Emit(*i);
+}
+
+FunctionTypeProto* FunctionTypeProto::Materialize(llvm::Deserializer& D) {
+ unsigned NumArgs = D.ReadInt();
+
+ FunctionTypeProto *FTP =
+ (FunctionTypeProto*)malloc(sizeof(FunctionTypeProto) +
+ NumArgs*sizeof(QualType));
+
+ // Default construct. Internal fields will be populated using
+ // deserialization.
+ new (FTP) FunctionTypeProto();
+
+ FTP->NumArgs = NumArgs;
+ FTP->ReadFunctionTypeInternal(D);
+
+ // Fill in the trailing argument array.
+ QualType *ArgInfo = reinterpret_cast<QualType *>(FTP+1);;
+
+ for (unsigned i = 0; i != NumArgs; ++i)
+ D.Read(ArgInfo[i]);
+
+ return FTP;
+}
Modified: cfe/trunk/include/clang/AST/Type.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/AST/Type.h?rev=43419&r1=43418&r2=43419&view=diff
==============================================================================
--- cfe/trunk/include/clang/AST/Type.h (original)
+++ cfe/trunk/include/clang/AST/Type.h Sat Oct 27 19:59:26 2007
@@ -790,6 +790,14 @@
static void Profile(llvm::FoldingSetNodeID &ID, QualType Result,
arg_type_iterator ArgTys, unsigned NumArgs,
bool isVariadic);
+
+ void Emit(llvm::Serializer& S) const;
+ static FunctionTypeProto* Materialize(llvm::Deserializer& D);
+
+protected:
+ // Used by deserialization.
+ FunctionTypeProto()
+ : FunctionType(FunctionProto, QualType(), false, QualType()) {}
};
More information about the cfe-commits
mailing list