aboutsummaryrefslogtreecommitdiff
path: root/include/llvm/Bitcode/Serialization.h
blob: 935452cc1b860f53973a35f11a94fe75538d563c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
//==- Serialization.h - Generic Object Serialization to Bitcode ---*- C++ -*-=//
//
//                     The LLVM Compiler Infrastructure
//
// This file was developed by Ted Kremenek and is distributed under the
// University of Illinois Open Source License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
//
// This file defines the interface for generic object serialization to
// LLVM bitcode.
//
//===----------------------------------------------------------------------===//

#ifndef LLVM_BITCODE_SERIALIZE
#define LLVM_BITCODE_SERIALIZE

namespace llvm {

class Serializer;
class Deserializer;  
template <typename T> struct SerializeTrait;
  
#define SERIALIZE_INT_TRAIT(TYPE)\
template <> struct SerializeTrait<TYPE> {\
  static void Emit(Serializer& S, TYPE X);\
  static void Read(Deserializer& S, TYPE& X); };

SERIALIZE_INT_TRAIT(bool)
SERIALIZE_INT_TRAIT(unsigned char)
SERIALIZE_INT_TRAIT(unsigned short)
SERIALIZE_INT_TRAIT(unsigned int)
SERIALIZE_INT_TRAIT(unsigned long)
SERIALIZE_INT_TRAIT(unsigned long long)

#undef SERIALIZE_INT_TRAIT
  
} // end namespace llvm

#endif