Added support in serializer and deserializer to create arbitrary blocks.

Added detection of end-of-stream in deserializer.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@43736 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Ted Kremenek
2007-11-05 21:36:35 +00:00
parent eb57ea7ea2
commit 0a6d98e10e
4 changed files with 40 additions and 5 deletions

View File

@ -153,6 +153,8 @@ public:
void RegisterPtr(const void* Ptr) {
RegisterPtr(ReadInt(),Ptr);
}
bool AtEnd();
private:
void ReadRecord();

View File

@ -25,7 +25,7 @@ namespace llvm {
class Serializer {
BitstreamWriter& Stream;
SmallVector<uint64_t,10> Record;
bool inBlock;
unsigned BlockLevel;
typedef DenseMap<const void*,unsigned> MapTy;
MapTy PtrMap;
@ -56,6 +56,9 @@ public:
void Flush() { if (inRecord()) EmitRecord(); }
void EnterBlock(unsigned BlockID = 8, unsigned CodeLen = 3);
void ExitBlock();
private:
void EmitRecord();
inline bool inRecord() { return Record.size() > 0; }