Author: kremenek Date: Wed Nov 14 18:05:03 2007 New Revision: 44152 URL: http://llvm.org/viewvc/llvm-project?rev=44152&view=rev Log: Fixed serious bug in BatchReadOwnedPtrs where in a chain of calls to deserialize objects if BatchReadOwnedPtrs was called more than once in the same call chain then the second call would overwrite the SerializedPtrIDs being used by the first call. Solved this problem by making the vector that holds the pointer IDs local to a function call. Now BatchReadOwnedPtrs is reentrant.
Modified: llvm/trunk/include/llvm/Bitcode/Deserialize.h Modified: llvm/trunk/include/llvm/Bitcode/Deserialize.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Bitcode/Deserialize.h?rev=44152&r1=44151&r2=44152&view=diff ============================================================================== --- llvm/trunk/include/llvm/Bitcode/Deserialize.h (original) +++ llvm/trunk/include/llvm/Bitcode/Deserialize.h Wed Nov 14 18:05:03 2007 @@ -126,7 +126,6 @@ unsigned AbbrevNo; unsigned RecordCode; Location StreamStart; - std::vector<SerializedPtrID> BatchIDVec; //===----------------------------------------------------------===// // Public Interface. @@ -213,7 +212,7 @@ template <typename T> void BatchReadOwnedPtrs(unsigned NumPtrs, T** Ptrs, bool AutoRegister=true) { - BatchIDVec.clear(); + llvm::SmallVector<SerializedPtrID,10> BatchIDVec; for (unsigned i = 0; i < NumPtrs; ++i) BatchIDVec.push_back(ReadPtrID()); @@ -234,8 +233,8 @@ void BatchReadOwnedPtrs(unsigned NumT1Ptrs, T1** Ptrs, T2*& P2, bool A1=true, bool A2=true) { - BatchIDVec.clear(); - + llvm::SmallVector<SerializedPtrID,10> BatchIDVec; + for (unsigned i = 0; i < NumT1Ptrs; ++i) BatchIDVec.push_back(ReadPtrID()); @@ -261,7 +260,7 @@ T2*& P2, T3*& P3, bool A1=true, bool A2=true, bool A3=true) { - BatchIDVec.clear(); + llvm::SmallVector<SerializedPtrID,10> BatchIDVec; for (unsigned i = 0; i < NumT1Ptrs; ++i) BatchIDVec.push_back(ReadPtrID()); _______________________________________________ llvm-commits mailing list llvm-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits