[llvm-commits] [llvm] r46150 - /llvm/trunk/include/llvm/ADT/ImmutableMap.h

Ted Kremenek kremenek at apple.com
Thu Jan 17 16:38:08 PST 2008


Author: kremenek
Date: Thu Jan 17 18:38:04 2008
New Revision: 46150

URL: http://llvm.org/viewvc/llvm-project?rev=46150&view=rev
Log:
Reverted implementation of ImmutableMap::find() to return a TreeTy* instead of
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.

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=46150&r1=46149&r2=46150&view=diff

==============================================================================
--- llvm/trunk/include/llvm/ADT/ImmutableMap.h (original)
+++ llvm/trunk/include/llvm/ADT/ImmutableMap.h Thu Jan 17 18:38:04 2008
@@ -188,15 +188,17 @@
   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.
   //===--------------------------------------------------===//  





More information about the llvm-commits mailing list