[llvm-commits] [llvm] r44032 - in /llvm/trunk/include/llvm/Bitcode: Deserialize.h Serialize.h
Ted Kremenek
kremenek at apple.com
Mon Nov 12 16:13:57 PST 2007
Author: kremenek
Date: Mon Nov 12 18:13:57 2007
New Revision: 44032
URL: http://llvm.org/viewvc/llvm-project?rev=44032&view=rev
Log:
Fixed bug with inconsistent serialization/deserialization in matching
calls to BatchEmitOwnedPtrs and BatchReadOwnedPtrs.
Modified:
llvm/trunk/include/llvm/Bitcode/Deserialize.h
llvm/trunk/include/llvm/Bitcode/Serialize.h
Modified: llvm/trunk/include/llvm/Bitcode/Deserialize.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Bitcode/Deserialize.h?rev=44032&r1=44031&r2=44032&view=diff
==============================================================================
--- llvm/trunk/include/llvm/Bitcode/Deserialize.h (original)
+++ llvm/trunk/include/llvm/Bitcode/Deserialize.h Mon Nov 12 18:13:57 2007
@@ -228,6 +228,37 @@
Ptrs[i] = p;
}
+ }
+
+ template <typename T1, typename T2, typename T3>
+ void BatchReadOwnedPtrs(unsigned NumT1Ptrs, T1** Ptrs,
+ T2*& P2, T3*& P3,
+ bool A1=true, bool A2=true, bool A3=true) {
+
+ BatchIDVec.clear();
+
+ for (unsigned i = 0; i < NumT1Ptrs; ++i)
+ BatchIDVec.push_back(ReadPtrID());
+
+ SerializedPtrID ID2 = ReadPtrID();
+ SerializedPtrID ID3 = ReadPtrID();
+
+ for (unsigned i = 0; i < NumT1Ptrs; ++i) {
+ SerializedPtrID& PtrID = BatchIDVec[i];
+
+ T1* p = PtrID ? SerializeTrait<T1>::Materialize(*this) : NULL;
+
+ if (PtrID && A1)
+ RegisterPtr(PtrID,p);
+
+ Ptrs[i] = p;
+ }
+
+ P2 = (ID2) ? SerializeTrait<T2>::Materialize(*this) : NULL;
+ if (ID2 && A2) RegisterPtr(ID2,P2);
+
+ P3 = (ID3) ? SerializeTrait<T3>::Materialize(*this) : NULL;
+ if (ID3 && A3) RegisterPtr(ID3,P3);
}
template <typename T>
Modified: llvm/trunk/include/llvm/Bitcode/Serialize.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Bitcode/Serialize.h?rev=44032&r1=44031&r2=44032&view=diff
==============================================================================
--- llvm/trunk/include/llvm/Bitcode/Serialize.h (original)
+++ llvm/trunk/include/llvm/Bitcode/Serialize.h Mon Nov 12 18:13:57 2007
@@ -93,6 +93,23 @@
for (unsigned i = 0; i < NumPtrs; ++i)
if (Ptrs[i]) SerializeTrait<T>::Emit(*this,*Ptrs[i]);
}
+
+ template <typename T1, typename T2, typename T3>
+ void BatchEmitOwnedPtrs(unsigned NumT1Ptrs, T1* const * Ptrs,
+ T2* p2, T3* p3) {
+
+ for (unsigned i = 0; i < NumT1Ptrs; ++i)
+ EmitPtr(Ptrs[i]);
+
+ EmitPtr(p2);
+ EmitPtr(p3);
+
+ for (unsigned i = 0; i < NumT1Ptrs; ++i)
+ if (Ptrs[i]) SerializeTrait<T1>::Emit(*this,*Ptrs[i]);
+
+ if (p2) SerializeTrait<T2>::Emit(*this,*p2);
+ if (p3) SerializeTrait<T3>::Emit(*this,*p3);
+ }
bool isRegistered(const void* p) const;
More information about the llvm-commits
mailing list