diff options
| author | Ted Kremenek <kremenek@apple.com> | 2007-11-05 20:47:27 +0000 | 
|---|---|---|
| committer | Ted Kremenek <kremenek@apple.com> | 2007-11-05 20:47:27 +0000 | 
| commit | e7fb505f5871fd35ab8fea4a462889dfdbc30c69 (patch) | |
| tree | fbbb4e03c9945dcdd56af627d2ffc2ea0fa7f8e6 /llvm/lib/Bitcode/Reader/Deserialize.cpp | |
| parent | 2f86ed734d711bd45ee90042504d570bf82d4f34 (diff) | |
| download | bcm5719-llvm-e7fb505f5871fd35ab8fea4a462889dfdbc30c69.tar.gz bcm5719-llvm-e7fb505f5871fd35ab8fea4a462889dfdbc30c69.zip | |
Added default creation of root-level block by bitstream serializer.
llvm-svn: 43732
Diffstat (limited to 'llvm/lib/Bitcode/Reader/Deserialize.cpp')
| -rw-r--r-- | llvm/lib/Bitcode/Reader/Deserialize.cpp | 25 | 
1 files changed, 22 insertions, 3 deletions
| diff --git a/llvm/lib/Bitcode/Reader/Deserialize.cpp b/llvm/lib/Bitcode/Reader/Deserialize.cpp index 0482b1f7e99..31d180ff32e 100644 --- a/llvm/lib/Bitcode/Reader/Deserialize.cpp +++ b/llvm/lib/Bitcode/Reader/Deserialize.cpp @@ -47,9 +47,28 @@ void Deserializer::ReadRecord() {    // FIXME: Check if we haven't run off the edge of the stream.    // FIXME: Handle abbreviations. -  // FIXME: Check for the correct code. -  unsigned Code = Stream.ReadCode(); +  unsigned Code; +  while (true) { +     +    Code = Stream.ReadCode(); +   +    if (Code == bitc::ENTER_SUBBLOCK) { +      // No known subblocks, always skip them. +      unsigned id = Stream.ReadSubBlockID(); +      Stream.EnterSubBlock(id); +      continue; +    } + +    if (Code == bitc::END_BLOCK) { +      bool x = Stream.ReadBlockEnd(); +      assert (!x && "Error at block end."); +      continue; +    } +     +    break; +  } +      assert (Record.size() == 0);      Stream.ReadRecord(Code,Record);      assert (Record.size() > 0); @@ -141,7 +160,7 @@ uintptr_t Deserializer::ReadInternalRefPtr() {    MapTy::value_type& E = BPatchMap.FindAndConstruct(BPKey(PtrId)); -  assert (!HasFinalPtr(E) && +  assert (HasFinalPtr(E) &&            "Cannot backpatch references.  Object must be already deserialized.");    return GetFinalPtr(E); | 

