aboutsummaryrefslogtreecommitdiffstats
path: root/include/llvm/Bitcode
diff options
context:
space:
mode:
authorTed Kremenek <kremenek@apple.com>2007-11-15 00:05:03 +0000
committerTed Kremenek <kremenek@apple.com>2007-11-15 00:05:03 +0000
commit3a7a7cd41a3c5dd233d54c2508b81488ab8053ab (patch)
treee82c0947884a1d43bede6e3c21e7b31f8aff5597 /include/llvm/Bitcode
parentf6afd3a80fc62c77f45583ec3d068e90472a5fd0 (diff)
downloadexternal_llvm-3a7a7cd41a3c5dd233d54c2508b81488ab8053ab.zip
external_llvm-3a7a7cd41a3c5dd233d54c2508b81488ab8053ab.tar.gz
external_llvm-3a7a7cd41a3c5dd233d54c2508b81488ab8053ab.tar.bz2
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. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@44152 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'include/llvm/Bitcode')
-rw-r--r--include/llvm/Bitcode/Deserialize.h9
1 files changed, 4 insertions, 5 deletions
diff --git a/include/llvm/Bitcode/Deserialize.h b/include/llvm/Bitcode/Deserialize.h
index 68d94b7..d0edede 100644
--- a/include/llvm/Bitcode/Deserialize.h
+++ b/include/llvm/Bitcode/Deserialize.h
@@ -126,7 +126,6 @@ private:
unsigned AbbrevNo;
unsigned RecordCode;
Location StreamStart;
- std::vector<SerializedPtrID> BatchIDVec;
//===----------------------------------------------------------===//
// Public Interface.
@@ -213,7 +212,7 @@ public:
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 @@ public:
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 @@ public:
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());