[PATCH] RFC: fail-fast iterators for DenseMap

Sanjoy Das sanjoy at playingwithpointers.com
Thu Feb 26 22:29:00 PST 2015


Hi ruiu, dexonsmith, dberlin,

This patch is an attempt at making `DenseMapIterator`s "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 `SmallPtrSet`s, 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

http://reviews.llvm.org/D7931

Files:
  include/llvm/ADT/ADTModCountTracker.h
  include/llvm/ADT/DenseMap.h

EMAIL PREFERENCES
  http://reviews.llvm.org/settings/panel/emailpreferences/
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D7931.20826.patch
Type: text/x-patch
Size: 9326 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20150227/70fd805f/attachment.bin>


More information about the llvm-commits mailing list