Fixed bug where tombstone key and empty key for DenseMap used for
authorTed Kremenek <kremenek@apple.com>
Mon, 5 Nov 2007 18:13:03 +0000 (18:13 +0000)
committerTed Kremenek <kremenek@apple.com>
Mon, 5 Nov 2007 18:13:03 +0000 (18:13 +0000)
pointer backpatching in deserializer were improperly created and
resulted in an assertion failure.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@43721 91177308-0d34-0410-b5e6-96231b3b80d8

include/llvm/Bitcode/Deserialize.h
include/llvm/Bitcode/Serialize.h

index 332a842d2800d468b419b33a1bdb621c6b230880..2454dca565dfb5e3dd4ae0207a1a72463126e85c 100644 (file)
@@ -56,13 +56,14 @@ class Deserializer {
     
   public:
     BPKey(unsigned PtrId) : Raw(PtrId << 1) { assert (PtrId > 0); }
+    BPKey(unsigned code, unsigned) : Raw(code) {}
     
     void MarkFinal() { Raw |= 0x1; }
     bool hasFinalPtr() const { return Raw & 0x1 ? true : false; }
     unsigned getID() const { return Raw >> 1; }
     
-    static inline BPKey getEmptyKey() { return 0; }
-    static inline BPKey getTombstoneKey() { return 1; }
+    static inline BPKey getEmptyKey() { return BPKey(0,0); }
+    static inline BPKey getTombstoneKey() { return BPKey(1,0); }
     static inline unsigned getHashValue(const BPKey& K) { return K.Raw & ~0x1; }
 
     static bool isEqual(const BPKey& K1, const BPKey& K2) {
index be5adb85eaad729817d7912963be12cee4b45d0e..197ab9f33d67cced519aa859694deab93e9e00ff 100644 (file)
@@ -32,6 +32,7 @@ class Serializer {
   
 public:
   Serializer(BitstreamWriter& stream, unsigned BlockID = 0);
+  
   ~Serializer();
   
   template <typename T>