Reapply "ADT: Require explicit ilist iterator/pointer conversions"
authorDuncan P. N. Exon Smith <dexonsmith@apple.com>
Sat, 7 Nov 2015 00:59:29 +0000 (00:59 +0000)
committerDuncan P. N. Exon Smith <dexonsmith@apple.com>
Sat, 7 Nov 2015 00:59:29 +0000 (00:59 +0000)
commit45d3f0d253091e1cda26614864b9df3d86608a56
tree880d68d793262f96ec1d9ddb90b67f3d724b6360
parent7d7668eb6bc4f2b1984e5841b16d87b038256231
Reapply "ADT: Require explicit ilist iterator/pointer conversions"

This reverts commit r252373, reapplying r252372 now that I've updated
clang-tools-extra.  Original commit message follows.

ADT: Require explicit ilist iterator/pointer conversions

Disallow implicit conversions between ilist iterators and element
points.  Explicit conversions still work of course.

This is the first step toward removing the undefined behaviour in
`ilist` and `iplist`:
http://lists.llvm.org/pipermail/llvm-dev/2015-October/091115.html

The motivation for removing the implicit iterators is that I came across
real bugs (that were *really* getting lucky).  More details and some
brief discussion later in that thread:
http://lists.llvm.org/pipermail/llvm-dev/2015-October/091617.html

Note: if you have out-of-tree code, it should be fairly easy to revert
this patch downstream while you update your out-of-tree call sites.
Note that these conversions are occasionally latent bugs (that may
happen to "work" now, but only because of getting lucky with UB;
follow-ups will change your luck).  When they are valid, I suggest using
`->getIterator()` to go from pointer to iterator, and `&*` to go from
iterator to pointer.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@252380 91177308-0d34-0410-b5e6-96231b3b80d8
include/llvm/ADT/ilist.h