[llvm-commits] [llvm] r43721 - in /llvm/trunk/include/llvm/Bitcode: Deserialize.h Serialize.h

Ted Kremenek kremenek at apple.com
Mon Nov 5 10:13:03 PST 2007


Author: kremenek
Date: Mon Nov  5 12:13:03 2007
New Revision: 43721

URL: http://llvm.org/viewvc/llvm-project?rev=43721&view=rev
Log:
Fixed bug where tombstone key and empty key for DenseMap used for
pointer backpatching in deserializer were improperly created and
resulted in an assertion failure.

Modified:
    llvm/trunk/include/llvm/Bitcode/Deserialize.h
    llvm/trunk/include/llvm/Bitcode/Serialize.h

Modified: llvm/trunk/include/llvm/Bitcode/Deserialize.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Bitcode/Deserialize.h?rev=43721&r1=43720&r2=43721&view=diff

==============================================================================
--- llvm/trunk/include/llvm/Bitcode/Deserialize.h (original)
+++ llvm/trunk/include/llvm/Bitcode/Deserialize.h Mon Nov  5 12:13:03 2007
@@ -56,13 +56,14 @@
     
   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) {

Modified: llvm/trunk/include/llvm/Bitcode/Serialize.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Bitcode/Serialize.h?rev=43721&r1=43720&r2=43721&view=diff

==============================================================================
--- llvm/trunk/include/llvm/Bitcode/Serialize.h (original)
+++ llvm/trunk/include/llvm/Bitcode/Serialize.h Mon Nov  5 12:13:03 2007
@@ -32,6 +32,7 @@
   
 public:
   Serializer(BitstreamWriter& stream, unsigned BlockID = 0);
+  
   ~Serializer();
   
   template <typename T>





More information about the llvm-commits mailing list