[PATCH] Add standard insert overloads to StringMap
Agustín Bergé
kaballo86 at hotmail.com
Mon Jun 16 14:48:48 PDT 2014
Changes in this iteration:
- Simplified implementation.
- Corrected doxygen comment.
- Reimplemented `GetOrCreateValue` on top of the new `insert`.
- Improved test case.
By having `GetOrCreateValue` call the new `insert` overload internally, I was able to detect a gross oversight on my first implementation. Inserting an element in the map can trigger a table rehashing, in which case the returned iterator was pointing to the wrong bucket. I sorted this in the simplest way that I could think that would give maximum performance, and that is by modifying `RehashTable` to map an old bucket number into the corresponding new bucket number. I would like to add a test case that triggers a table rehash but I'm not sure how to do that, suggestions?
http://reviews.llvm.org/D4153
Files:
include/llvm/ADT/StringMap.h
lib/Support/StringMap.cpp
unittests/ADT/StringMapTest.cpp
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D4153.10460.patch
Type: text/x-patch
Size: 7161 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20140616/930a69f0/attachment.bin>
More information about the llvm-commits
mailing list