diff --git a/include/llvm/Bitcode/Serialize.h b/include/llvm/Bitcode/Serialize.h index 7b6d8226a08..b0b39de3b79 100644 --- a/include/llvm/Bitcode/Serialize.h +++ b/include/llvm/Bitcode/Serialize.h @@ -37,6 +37,17 @@ public: template inline void Emit(const T& X) { SerializeTrait::Emit(*this,X); } + template + struct Emitter { + Serializer &S; + + Emitter(Serializer& s) : S(s) {} + void operator()(const T& x) const { S.Emit(x); } + }; + + template + Emitter MakeEmitter() { return Emitter(*this); } + void EmitInt(uint64_t X); void EmitSInt(int64_t X);