summaryrefslogtreecommitdiffstats
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
commit7ea05687bec9c342b025f7e5b3a9da7c5fb26f41 (patch)
tree552d818c4c2870808bb59f4c23b586c5b48fa1b1
parent41f375a45ccb33580e0b3f23bebdeb190a6ea8bb (diff)
downloadbcm5719-llvm-7ea05687bec9c342b025f7e5b3a9da7c5fb26f41.tar.gz
bcm5719-llvm-7ea05687bec9c342b025f7e5b3a9da7c5fb26f41.zip
Changed ImmutableMap::find to return an iterator instead of a pointer
to the tree node. llvm-svn: 46034
-rw-r--r--llvm/include/llvm/ADT/ImmutableMap.h21
1 files changed, 11 insertions, 10 deletions
diff --git a/llvm/include/llvm/ADT/ImmutableMap.h b/llvm/include/llvm/ADT/ImmutableMap.h
index 24aef7ccfdc..9646929c3ca 100644
--- a/llvm/include/llvm/ADT/ImmutableMap.h
+++ b/llvm/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.
//===--------------------------------------------------===//
OpenPOWER on IntegriCloud