Add a comment explaining how DenseMap::insert works, because it is not
authorTorok Edwin <edwintorok@gmail.com>
Wed, 7 Oct 2009 09:23:56 +0000 (09:23 +0000)
committerTorok Edwin <edwintorok@gmail.com>
Wed, 7 Oct 2009 09:23:56 +0000 (09:23 +0000)
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.

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

include/llvm/ADT/DenseMap.h

index daeda28d1298d535b701b6aa559e2bd706aaf993..0ed2d5a25257c0662c3bb97d03f84952a412d9cd 100644 (file)
@@ -145,6 +145,9 @@ public:
     return ValueT();
   }
 
     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))
   std::pair<iterator, bool> insert(const std::pair<KeyT, ValueT> &KV) {
     BucketT *TheBucket;
     if (LookupBucketFor(KV.first, TheBucket))