Reverted implementation of ImmutableMap::find() to return a TreeTy* instead of
authorTed Kremenek <kremenek@apple.com>
Fri, 18 Jan 2008 00:38:04 +0000 (00:38 +0000)
committerTed Kremenek <kremenek@apple.com>
Fri, 18 Jan 2008 00:38:04 +0000 (00:38 +0000)
an iterator, since the implementation returned an iterator that pointed to a
different node! Renamed this implementation to SlimFind() so that users do not
expect it to return an iterator (it is a more efficient implementation than
returning an iterator if the user just wants to find the value of a key).

Added a FIXME to implement ImmutableMap::find() that returns an iterator.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@46150 91177308-0d34-0410-b5e6-96231b3b80d8

include/llvm/ADT/ImmutableMap.h

index 273a2977387dfb4adb618c53461a05fcfe623291..de1c5875a32e6f59bde7042c97d6a998a696c125 100644 (file)
@@ -188,15 +188,17 @@ public:
   iterator begin() const { return iterator(Root); }
   iterator end() const { return iterator(); }  
   
-  iterator find(key_type_ref K) const {
+  TreeTy* SlimFind(key_type_ref K) const {
     if (Root) {
       TreeTy* T = Root->find(K);
-      if (T) return iterator(T);
+      if (T) return T;
     }
     
-    return iterator();
+    return NULL;
   }
   
+  // FIXME: Add 'find' that returns an iterator instead of a TreeTy*.
+  
   //===--------------------------------------------------===//    
   // Utility methods.
   //===--------------------------------------------------===//