Fix a bug in the densemap that was killing the local allocator, and probably
authorChris Lattner <sabre@nondot.org>
Thu, 26 Feb 2004 05:00:15 +0000 (05:00 +0000)
committerChris Lattner <sabre@nondot.org>
Thu, 26 Feb 2004 05:00:15 +0000 (05:00 +0000)
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? :)

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

include/Support/DenseMap.h
include/llvm/ADT/DenseMap.h
include/llvm/ADT/IndexedMap.h

index 9d713d97c363f49176dfa65c60af1da5ea8b4f62..9d55435c91f94ed4397d7bd04c8e13f6679ec7ca 100644 (file)
@@ -33,7 +33,7 @@ class DenseMap {
     ToIndexT toIndex_;
 
 public:
-    DenseMap() { }
+    DenseMap() : nullVal_(T()) { }
 
     explicit DenseMap(const T& val) : nullVal_(val) { }
 
index 9d713d97c363f49176dfa65c60af1da5ea8b4f62..9d55435c91f94ed4397d7bd04c8e13f6679ec7ca 100644 (file)
@@ -33,7 +33,7 @@ class DenseMap {
     ToIndexT toIndex_;
 
 public:
-    DenseMap() { }
+    DenseMap() : nullVal_(T()) { }
 
     explicit DenseMap(const T& val) : nullVal_(val) { }
 
index 9d713d97c363f49176dfa65c60af1da5ea8b4f62..9d55435c91f94ed4397d7bd04c8e13f6679ec7ca 100644 (file)
@@ -33,7 +33,7 @@ class DenseMap {
     ToIndexT toIndex_;
 
 public:
-    DenseMap() { }
+    DenseMap() : nullVal_(T()) { }
 
     explicit DenseMap(const T& val) : nullVal_(val) { }