diff options
author | Ted Kremenek <kremenek@apple.com> | 2007-11-14 08:05:03 +0000 |
---|---|---|
committer | Ted Kremenek <kremenek@apple.com> | 2007-11-14 08:05:03 +0000 |
commit | 9e11d1ef43ff6b6b8c345057818a10e1cb75efa5 (patch) | |
tree | 6baa3e0888d91ea596c33505582dfd215b79e2ab /include/llvm/Bitcode | |
parent | 4d0fbf31e38f28a3c1501e74d7058a88bb8d7c2c (diff) | |
download | external_llvm-9e11d1ef43ff6b6b8c345057818a10e1cb75efa5.zip external_llvm-9e11d1ef43ff6b6b8c345057818a10e1cb75efa5.tar.gz external_llvm-9e11d1ef43ff6b6b8c345057818a10e1cb75efa5.tar.bz2 |
Added two new overloaded versions of BatchEmitOwnedPtrs and
BatchReadOwnedPtrs.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@44105 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'include/llvm/Bitcode')
-rw-r--r-- | include/llvm/Bitcode/Deserialize.h | 26 | ||||
-rw-r--r-- | include/llvm/Bitcode/Serialize.h | 14 |
2 files changed, 40 insertions, 0 deletions
diff --git a/include/llvm/Bitcode/Deserialize.h b/include/llvm/Bitcode/Deserialize.h index 0f745d9..68d94b7 100644 --- a/include/llvm/Bitcode/Deserialize.h +++ b/include/llvm/Bitcode/Deserialize.h @@ -230,6 +230,32 @@ public: } } + template <typename T1, typename T2> + void BatchReadOwnedPtrs(unsigned NumT1Ptrs, T1** Ptrs, T2*& P2, + bool A1=true, bool A2=true) { + + BatchIDVec.clear(); + + for (unsigned i = 0; i < NumT1Ptrs; ++i) + BatchIDVec.push_back(ReadPtrID()); + + SerializedPtrID ID2 = ReadPtrID(); + + for (unsigned i = 0; i < NumT1Ptrs; ++i) { + SerializedPtrID& PtrID = BatchIDVec[i]; + + T1* p = PtrID ? SerializeTrait<T1>::Create(*this) : NULL; + + if (PtrID && A1) + RegisterPtr(PtrID,p); + + Ptrs[i] = p; + } + + P2 = (ID2) ? SerializeTrait<T2>::Create(*this) : NULL; + if (ID2 && A2) RegisterPtr(ID2,P2); + } + template <typename T1, typename T2, typename T3> void BatchReadOwnedPtrs(unsigned NumT1Ptrs, T1** Ptrs, T2*& P2, T3*& P3, diff --git a/include/llvm/Bitcode/Serialize.h b/include/llvm/Bitcode/Serialize.h index 0b99c57..60d9cb2 100644 --- a/include/llvm/Bitcode/Serialize.h +++ b/include/llvm/Bitcode/Serialize.h @@ -94,6 +94,20 @@ public: if (Ptrs[i]) SerializeTrait<T>::Emit(*this,*Ptrs[i]); } + template <typename T1, typename T2> + void BatchEmitOwnedPtrs(unsigned NumT1Ptrs, T1* const * Ptrs, T2* p2) { + + for (unsigned i = 0; i < NumT1Ptrs; ++i) + EmitPtr(Ptrs[i]); + + EmitPtr(p2); + + for (unsigned i = 0; i < NumT1Ptrs; ++i) + if (Ptrs[i]) SerializeTrait<T1>::Emit(*this,*Ptrs[i]); + + if (p2) SerializeTrait<T2>::Emit(*this,*p2); + } + template <typename T1, typename T2, typename T3> void BatchEmitOwnedPtrs(unsigned NumT1Ptrs, T1* const * Ptrs, T2* p2, T3* p3) { |