Add tests for *DenesMap for both key and value types' construction and
authorChandler Carruth <chandlerc@gmail.com>
Sun, 17 Jun 2012 10:33:51 +0000 (10:33 +0000)
committerChandler Carruth <chandlerc@gmail.com>
Sun, 17 Jun 2012 10:33:51 +0000 (10:33 +0000)
commit6446d7e6d641135bdf9dc315ed69d0b10067fbd6
tree1b64b1d811ade03ef9ab784cdebf8e7e502d2ada
parentdd9d38d57bbd2161e04af90a9e03011afb039b16
Add tests for *DenesMap for both key and value types' construction and
destruction and fix a bug in SmallDenseMap they caught.

This is kind of a poor-man's version of the testing that just adds the
addresses to a set on construction and removes them on destruction. We
check that double construction and double destruction don't occur.
Amusingly enough, this is enough to catch a lot of SmallDenseMap issues
because we spend a lot of time with fixed stable addresses in the inline
buffer.

The SmallDenseMap bug fix included makes grow() not double-destroy in
some cases. It also fixes a FIXME there, the code was pretty crappy. We
now don't have any wasted initialization, but we do move the entries in
inline bucket array an extra time. It's probably a better tradeoff, and
is much easier to get correct.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@158639 91177308-0d34-0410-b5e6-96231b3b80d8
include/llvm/ADT/DenseMap.h
unittests/ADT/DenseMapTest.cpp