llvm.org GIT mirror llvm / dd479dd
Fixed bug with inconsistent serialization/deserialization in matching calls to BatchEmitOwnedPtrs and BatchReadOwnedPtrs. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@44032 91177308-0d34-0410-b5e6-96231b3b80d8 Ted Kremenek 12 years ago
2 changed file(s) with 48 addition(s) and 0 deletion(s). Raw diff Collapse all Expand all
227227
228228 Ptrs[i] = p;
229229 }
230 }
231
232 template
233 void BatchReadOwnedPtrs(unsigned NumT1Ptrs, T1** Ptrs,
234 T2*& P2, T3*& P3,
235 bool A1=true, bool A2=true, bool A3=true) {
236
237 BatchIDVec.clear();
238
239 for (unsigned i = 0; i < NumT1Ptrs; ++i)
240 BatchIDVec.push_back(ReadPtrID());
241
242 SerializedPtrID ID2 = ReadPtrID();
243 SerializedPtrID ID3 = ReadPtrID();
244
245 for (unsigned i = 0; i < NumT1Ptrs; ++i) {
246 SerializedPtrID& PtrID = BatchIDVec[i];
247
248 T1* p = PtrID ? SerializeTrait::Materialize(*this) : NULL;
249
250 if (PtrID && A1)
251 RegisterPtr(PtrID,p);
252
253 Ptrs[i] = p;
254 }
255
256 P2 = (ID2) ? SerializeTrait::Materialize(*this) : NULL;
257 if (ID2 && A2) RegisterPtr(ID2,P2);
258
259 P3 = (ID3) ? SerializeTrait::Materialize(*this) : NULL;
260 if (ID3 && A3) RegisterPtr(ID3,P3);
230261 }
231262
232263 template
9292 for (unsigned i = 0; i < NumPtrs; ++i)
9393 if (Ptrs[i]) SerializeTrait::Emit(*this,*Ptrs[i]);
9494 }
95
96 template
97 void BatchEmitOwnedPtrs(unsigned NumT1Ptrs, T1* const * Ptrs,
98 T2* p2, T3* p3) {
99
100 for (unsigned i = 0; i < NumT1Ptrs; ++i)
101 EmitPtr(Ptrs[i]);
102
103 EmitPtr(p2);
104 EmitPtr(p3);
105
106 for (unsigned i = 0; i < NumT1Ptrs; ++i)
107 if (Ptrs[i]) SerializeTrait::Emit(*this,*Ptrs[i]);
108
109 if (p2) SerializeTrait::Emit(*this,*p2);
110 if (p3) SerializeTrait::Emit(*this,*p3);
111 }
95112
96113 bool isRegistered(const void* p) const;
97114