[llvm-commits] [llvm] r43732 - in /llvm/trunk: include/llvm/Bitcode/Serialize.h lib/Bitcode/Reader/Deserialize.cpp
Ted Kremenek
kremenek at apple.com
Mon Nov 5 12:47:27 PST 2007
Author: kremenek
Date: Mon Nov 5 14:47:27 2007
New Revision: 43732
URL: http://llvm.org/viewvc/llvm-project?rev=43732&view=rev
Log:
Added default creation of root-level block by bitstream serializer.
Modified:
llvm/trunk/include/llvm/Bitcode/Serialize.h
llvm/trunk/lib/Bitcode/Reader/Deserialize.cpp
Modified: llvm/trunk/include/llvm/Bitcode/Serialize.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Bitcode/Serialize.h?rev=43732&r1=43731&r2=43732&view=diff
==============================================================================
--- llvm/trunk/include/llvm/Bitcode/Serialize.h (original)
+++ llvm/trunk/include/llvm/Bitcode/Serialize.h Mon Nov 5 14:47:27 2007
@@ -31,7 +31,7 @@
MapTy PtrMap;
public:
- Serializer(BitstreamWriter& stream, unsigned BlockID = 0);
+ Serializer(BitstreamWriter& stream, unsigned BlockID = 8);
~Serializer();
Modified: llvm/trunk/lib/Bitcode/Reader/Deserialize.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Bitcode/Reader/Deserialize.cpp?rev=43732&r1=43731&r2=43732&view=diff
==============================================================================
--- llvm/trunk/lib/Bitcode/Reader/Deserialize.cpp (original)
+++ llvm/trunk/lib/Bitcode/Reader/Deserialize.cpp Mon Nov 5 14:47:27 2007
@@ -47,9 +47,28 @@
// 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 @@
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);
More information about the llvm-commits
mailing list