aboutsummaryrefslogtreecommitdiffstats
path: root/include/llvm
diff options
context:
space:
mode:
authorDaniel Dunbar <daniel@zuster.org>2008-08-29 00:48:44 +0000
committerDaniel Dunbar <daniel@zuster.org>2008-08-29 00:48:44 +0000
commit7b75fbf224c0a2d181c35708a27c514ae798c904 (patch)
tree407aa7c3d8688253f3754c416749f3cf923897e4 /include/llvm
parent4d46d0af583b95a5d4f7d490f542c4fb65b9e824 (diff)
downloadexternal_llvm-7b75fbf224c0a2d181c35708a27c514ae798c904.tar.gz
external_llvm-7b75fbf224c0a2d181c35708a27c514ae798c904.tar.bz2
external_llvm-7b75fbf224c0a2d181c35708a27c514ae798c904.zip
Add DenseMap::lookup:
/// lookup - Return the entry for the specified key, or a default /// constructed value if no such entry exists. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@55523 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'include/llvm')
-rw-r--r--include/llvm/ADT/DenseMap.h9
1 files changed, 9 insertions, 0 deletions
diff --git a/include/llvm/ADT/DenseMap.h b/include/llvm/ADT/DenseMap.h
index df8f464ada..70d09a6617 100644
--- a/include/llvm/ADT/DenseMap.h
+++ b/include/llvm/ADT/DenseMap.h
@@ -189,6 +189,15 @@ public:
return end();
}
+ /// lookup - Return the entry for the specified key, or a default
+ /// constructed value if no such entry exists.
+ ValueT lookup(const KeyT &Val) const {
+ BucketT *TheBucket;
+ if (LookupBucketFor(Val, TheBucket))
+ return TheBucket->second;
+ return ValueT();
+ }
+
std::pair<iterator, bool> insert(const std::pair<KeyT, ValueT> &KV) {
BucketT *TheBucket;
if (LookupBucketFor(KV.first, TheBucket))