diff options
author | Ted Kremenek <kremenek@apple.com> | 2007-10-25 18:42:52 +0000 |
---|---|---|
committer | Ted Kremenek <kremenek@apple.com> | 2007-10-25 18:42:52 +0000 |
commit | 2423e03ca804e64998df1b65f58e62b867283c92 (patch) | |
tree | e1972402ad068ba4e4afdadc92bcf991e4901669 /include/llvm | |
parent | 2c8ca5c415b876ef816286202621b1cf2c30fcad (diff) | |
download | external_llvm-2423e03ca804e64998df1b65f58e62b867283c92.zip external_llvm-2423e03ca804e64998df1b65f58e62b867283c92.tar.gz external_llvm-2423e03ca804e64998df1b65f58e62b867283c92.tar.bz2 |
Added special treatment of serializing NULL pointers.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@43357 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'include/llvm')
-rw-r--r-- | include/llvm/Bitcode/Deserialize.h | 4 | ||||
-rw-r--r-- | include/llvm/Bitcode/Serialize.h | 2 |
2 files changed, 5 insertions, 1 deletions
diff --git a/include/llvm/Bitcode/Deserialize.h b/include/llvm/Bitcode/Deserialize.h index f5adcff..164c70a 100644 --- a/include/llvm/Bitcode/Deserialize.h +++ b/include/llvm/Bitcode/Deserialize.h @@ -86,6 +86,10 @@ public: template <typename T> inline T* ReadOwnedPtr() { unsigned PtrId = ReadInt(); + + if (PtrId == 0) + return NULL; + T* x = SerializeTrait<T>::Materialize(*this); RegisterPtr(PtrId,x); return x; diff --git a/include/llvm/Bitcode/Serialize.h b/include/llvm/Bitcode/Serialize.h index dc1fe64..72aac9d 100644 --- a/include/llvm/Bitcode/Serialize.h +++ b/include/llvm/Bitcode/Serialize.h @@ -47,7 +47,7 @@ public: template <typename T> void EmitOwnedPtr(T* ptr) { EmitPtr(ptr); - SerializeTrait<T>::Emit(*this,*ptr); + if (ptr) SerializeTrait<T>::Emit(*this,*ptr); } void Flush() { if (inRecord()) EmitRecord(); } |