Author: kremenek Date: Tue Jan 15 17:53:53 2008 New Revision: 46034 URL: http://llvm.org/viewvc/llvm-project?rev=46034&view=rev Log: Changed ImmutableMap::find to return an iterator instead of a pointer to the tree node.
Modified: llvm/trunk/include/llvm/ADT/ImmutableMap.h Modified: llvm/trunk/include/llvm/ADT/ImmutableMap.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/ADT/ImmutableMap.h?rev=46034&r1=46033&r2=46034&view=diff ============================================================================== --- llvm/trunk/include/llvm/ADT/ImmutableMap.h (original) +++ llvm/trunk/include/llvm/ADT/ImmutableMap.h Tue Jan 15 17:53:53 2008 @@ -98,15 +98,7 @@ 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 @@ 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 @@ 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. //===--------------------------------------------------===// _______________________________________________ llvm-commits mailing list llvm-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits