This patch is an attempt at making DenseMapIterators "fail-fast".
Fail-fast iterators that have been invalidated due to insertion into
the host DenseMap deterministically trip an assert (in debug mode)
on access, instead of non-deterministically hitting memory corruption
issues.
(This exact same thing can be done for SmallPtrSets, but that is a
later change.)
This change is fairly rough at the moment, but I want to get some
early feedback on the approach and style before I spend too much time
on this.
This change, in its current form, has already helped me fix two
existing bugs:
http://reviews.llvm.org/rL230718
http://reviews.llvm.org/rL230719
Hmm...
What do you think about making this be automatically handled by the epoch utility? That is, localize the NDEBUG behavior there. There is no getting around the fact that this makes data-structures ABI-incompatible between NDEBUG and !NDEBUG, so I'd probably just make it a conditional typedef of the implementation class template.