llvm.org GIT mirror llvm / 7da75c5
Added "Emitter" functor to allow easy emitting of elements of a container using std::for_each. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@44589 91177308-0d34-0410-b5e6-96231b3b80d8 Ted Kremenek 12 years ago
1 changed file(s) with 11 addition(s) and 0 deletion(s). Raw diff Collapse all Expand all
3535
3636 template
3737 inline void Emit(const T& X) { SerializeTrait::Emit(*this,X); }
38
39 template
40 struct Emitter {
41 Serializer &S;
42
43 Emitter(Serializer& s) : S(s) {}
44 void operator()(const T& x) const { S.Emit(x); }
45 };
46
47 template
48 Emitter MakeEmitter() { return Emitter(*this); }
3849
3950 void EmitInt(uint64_t X);
4051 void EmitSInt(int64_t X);