make lookup failures not fatal.
authorChris Lattner <sabre@nondot.org>
Tue, 27 Jul 2010 18:59:50 +0000 (18:59 +0000)
committerChris Lattner <sabre@nondot.org>
Tue, 27 Jul 2010 18:59:50 +0000 (18:59 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@109530 91177308-0d34-0410-b5e6-96231b3b80d8

include/llvm/ADT/ScopedHashTable.h

index b5ca374a7ddd46acfb5ecd9a3baa72baf53eed2a..c96ad19707f38a2bdade59507120bde1bd05078b 100644 (file)
@@ -139,7 +139,12 @@ public:
   }
 
   V lookup(const K &Key) {
-    return TopLevelMap[Key]->getValue();
+    typename DenseMap<K, ScopedHashTableVal<K, V, KInfo>*, KInfo>::iterator
+      I = TopLevelMap.find(Key);
+    if (I != TopLevelMap.end())
+      return I->second->getValue();
+      
+    return V();
   }
 
   void insert(const K &Key, const V &Val) {