From 7f05aa72f970bdb92c831a83b02197b8699f7635 Mon Sep 17 00:00:00 2001 From: Evan Cheng Date: Tue, 2 Mar 2010 02:37:33 +0000 Subject: [PATCH] Add count() and lookup() to ScopedHashTable. It might be useful to get information out of the hash table. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@97542 91177308-0d34-0410-b5e6-96231b3b80d8 --- include/llvm/ADT/ScopedHashTable.h | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/include/llvm/ADT/ScopedHashTable.h b/include/llvm/ADT/ScopedHashTable.h index d5382954c63..df766935db7 100644 --- a/include/llvm/ADT/ScopedHashTable.h +++ b/include/llvm/ADT/ScopedHashTable.h @@ -130,6 +130,14 @@ public: 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!"); -- 2.34.1