[llvm-commits] [llvm] r83458 - /llvm/trunk/include/llvm/ADT/DenseMap.h

Torok Edwin edwintorok at gmail.com
Wed Oct 7 02:23:56 PDT 2009


Author: edwin
Date: Wed Oct  7 04:23:56 2009
New Revision: 83458

URL: http://llvm.org/viewvc/llvm-project?rev=83458&view=rev
Log:
Add a comment explaining how DenseMap::insert works, because it is not
intuitive.
It does NOT update the value if the key is already in the map,
it also returns false if the key is already in the map, regardless
if the value matched.

Modified:
    llvm/trunk/include/llvm/ADT/DenseMap.h

Modified: llvm/trunk/include/llvm/ADT/DenseMap.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/ADT/DenseMap.h?rev=83458&r1=83457&r2=83458&view=diff

==============================================================================
--- llvm/trunk/include/llvm/ADT/DenseMap.h (original)
+++ llvm/trunk/include/llvm/ADT/DenseMap.h Wed Oct  7 04:23:56 2009
@@ -145,6 +145,9 @@
     return ValueT();
   }
 
+  // Inserts key,value pair into the map if the key isn't already in the map.
+  // If the key is already in the map, it returns false and doesn't update the
+  // value.
   std::pair<iterator, bool> insert(const std::pair<KeyT, ValueT> &KV) {
     BucketT *TheBucket;
     if (LookupBucketFor(KV.first, TheBucket))





More information about the llvm-commits mailing list