[llvm-commits] CVS: llvm/include/Support/DenseMap.h

Chris Lattner lattner at cs.uiuc.edu
Wed Feb 25 23:01:07 PST 2004


Changes in directory llvm/include/Support:

DenseMap.h updated: 1.2 -> 1.3

---
Log message:

Fix a bug in the densemap that was killing the local allocator, and probably
other clients.  The problem is that the nullVal member was left to the default
constructor to initialize, which for int's does nothing (ie, leaves it unspecified).

To get a zero value, we must use T().  It's C++ wonderful? :)



---
Diffs of the changes:  (+1 -1)

Index: llvm/include/Support/DenseMap.h
diff -u llvm/include/Support/DenseMap.h:1.2 llvm/include/Support/DenseMap.h:1.3
--- llvm/include/Support/DenseMap.h:1.2	Wed Feb 25 22:07:12 2004
+++ llvm/include/Support/DenseMap.h	Wed Feb 25 23:00:15 2004
@@ -33,7 +33,7 @@
     ToIndexT toIndex_;
 
 public:
-    DenseMap() { }
+    DenseMap() : nullVal_(T()) { }
 
     explicit DenseMap(const T& val) : nullVal_(val) { }
 





More information about the llvm-commits mailing list