[llvm-commits] [llvm] r109530 - /llvm/trunk/include/llvm/ADT/ScopedHashTable.h

Chris Lattner sabre at nondot.org
Tue Jul 27 11:59:50 PDT 2010


Author: lattner
Date: Tue Jul 27 13:59:50 2010
New Revision: 109530

URL: http://llvm.org/viewvc/llvm-project?rev=109530&view=rev
Log:
make lookup failures not fatal.

Modified:
    llvm/trunk/include/llvm/ADT/ScopedHashTable.h

Modified: llvm/trunk/include/llvm/ADT/ScopedHashTable.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/ADT/ScopedHashTable.h?rev=109530&r1=109529&r2=109530&view=diff
==============================================================================
--- llvm/trunk/include/llvm/ADT/ScopedHashTable.h (original)
+++ llvm/trunk/include/llvm/ADT/ScopedHashTable.h Tue Jul 27 13:59:50 2010
@@ -139,7 +139,12 @@
   }
 
   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) {





More information about the llvm-commits mailing list