diff --git a/include/llvm/Bitcode/Deserialize.h b/include/llvm/Bitcode/Deserialize.h index 8a9be99199f..87d0f12728a 100644 --- a/include/llvm/Bitcode/Deserialize.h +++ b/include/llvm/Bitcode/Deserialize.h @@ -126,6 +126,7 @@ private: unsigned AbbrevNo; unsigned RecordCode; Location StreamStart; + std::vector BatchIDVec; //===----------------------------------------------------------===// // Public Interface. @@ -213,10 +214,11 @@ public: template void BatchReadOwnedPtrs(unsigned NumPtrs, T** Ptrs, bool AutoRegister=true) { for (unsigned i = 0; i < NumPtrs; ++i) - reinterpret_cast(Ptrs[i]) = ReadPtrID(); + BatchIDVec.push_back(ReadPtrID()); for (unsigned i = 0; i < NumPtrs; ++i) { - SerializedPtrID PtrID = reinterpret_cast(Ptrs[i]); + SerializedPtrID& PtrID = BatchIDVec[i]; + T* p = PtrID ? SerializeTrait::Materialize(*this) : NULL; if (PtrID && AutoRegister)