summaryrefslogtreecommitdiff
path: root/include/llvm/ADT/ImmutableMap.h
diff options
context:
space:
mode:
authorTed Kremenek <kremenek@apple.com>2008-01-15 23:53:53 +0000
committerTed Kremenek <kremenek@apple.com>2008-01-15 23:53:53 +0000
commit316e98447122fc3f1e99930583a305ba481e848c (patch)
treee5c9fd08518c07f849a8b85c4eafbe277a5b64aa /include/llvm/ADT/ImmutableMap.h
parent5e563c326490207ebd58d47935fb9efda7638aa2 (diff)
downloadllvm-316e98447122fc3f1e99930583a305ba481e848c.tar.gz
llvm-316e98447122fc3f1e99930583a305ba481e848c.tar.bz2
llvm-316e98447122fc3f1e99930583a305ba481e848c.tar.xz
Changed ImmutableMap::find to return an iterator instead of a pointer
to the tree node. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@46034 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'include/llvm/ADT/ImmutableMap.h')
-rw-r--r--include/llvm/ADT/ImmutableMap.h21
1 files changed, 11 insertions, 10 deletions
diff --git a/include/llvm/ADT/ImmutableMap.h b/include/llvm/ADT/ImmutableMap.h
index 24aef7ccfd..9646929c3c 100644
--- a/include/llvm/ADT/ImmutableMap.h
+++ b/include/llvm/ADT/ImmutableMap.h
@@ -98,15 +98,7 @@ public:
bool contains(key_type_ref K) const {
return Root ? Root->contains(K) : false;
}
-
- data_type* find(key_type_ref K) const {
- if (Root) {
- TreeTy* T = Root->find(K);
- if (T) return &T->getValue().second;
- }
-
- return NULL;
- }
+
bool operator==(ImmutableMap RHS) const {
return Root && RHS.Root ? Root->isEqual(*RHS.Root) : Root == RHS.Root;
@@ -171,7 +163,7 @@ public:
iterator() {}
iterator(TreeTy* t) : itr(t) {}
- friend class ImmutableSet<ValT,ValInfo>;
+ friend class ImmutableMap;
public:
inline value_type_ref operator*() const { return itr->getValue(); }
@@ -189,6 +181,15 @@ public:
iterator begin() const { return iterator(Root); }
iterator end() const { return iterator(); }
+ iterator find(key_type_ref K) const {
+ if (Root) {
+ TreeTy* T = Root->find(K);
+ if (T) return iterator(T);
+ }
+
+ return iterator();
+ }
+
//===--------------------------------------------------===//
// Utility methods.
//===--------------------------------------------------===//