1 //==- Serialization.h - Generic Object Serialization to Bitcode ---*- C++ -*-=//
3 // The LLVM Compiler Infrastructure
5 // This file was developed by Ted Kremenek and is distributed under the
6 // University of Illinois Open Source License. See LICENSE.TXT for details.
8 //===----------------------------------------------------------------------===//
10 // This file defines the interface for generic object serialization to
13 //===----------------------------------------------------------------------===//
15 #ifndef LLVM_BITCODE_SERIALIZE
16 #define LLVM_BITCODE_SERIALIZE
22 template <typename T> struct SerializeTrait;
24 #define SERIALIZE_INT_TRAIT(TYPE)\
25 template <> struct SerializeTrait<TYPE> {\
26 static void Emit(Serializer& S, TYPE X);\
27 static void Read(Deserializer& S, TYPE& X);\
28 static TYPE ReadVal(Deserializer& S); };
30 SERIALIZE_INT_TRAIT(bool)
31 SERIALIZE_INT_TRAIT(unsigned char)
32 SERIALIZE_INT_TRAIT(unsigned short)
33 SERIALIZE_INT_TRAIT(unsigned int)
34 SERIALIZE_INT_TRAIT(unsigned long)
36 #undef SERIALIZE_INT_TRAIT
38 } // end namespace llvm