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

Evan Cheng evan.cheng at apple.com
Mon Mar 1 18:37:33 PST 2010


Author: evancheng
Date: Mon Mar  1 20:37:33 2010
New Revision: 97542

URL: http://llvm.org/viewvc/llvm-project?rev=97542&view=rev
Log:
Add count() and lookup() to ScopedHashTable. It might be useful to get information out of the hash table.

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=97542&r1=97541&r2=97542&view=diff
==============================================================================
--- llvm/trunk/include/llvm/ADT/ScopedHashTable.h (original)
+++ llvm/trunk/include/llvm/ADT/ScopedHashTable.h Mon Mar  1 20:37:33 2010
@@ -130,6 +130,14 @@
     assert(CurScope == 0 && TopLevelMap.empty() && "Scope imbalance!");
   }
 
+  bool count(const K &Key) const {
+    return TopLevelMap.count(Key);
+  }
+
+  V lookup(const K &Key) {
+    return TopLevelMap[Key].getValue();
+  }
+
   void insert(const K &Key, const V &Val) {
     assert(CurScope && "No scope active!");
 





More information about the llvm-commits mailing list