[llvm] r214737 - Path: Stop claiming path::const_iterator is bidirectional

Duncan P. N. Exon Smith dexonsmith at apple.com
Mon Aug 4 12:43:29 PDT 2014


> On 2014-Aug-04, at 11:33, Justin Bogner <mail at justinbogner.com> wrote:
> 
> "Duncan P. N. Exon Smith" <dexonsmith at apple.com> writes:
>>> On 2014-Aug-04, at 10:36, Justin Bogner <mail at justinbogner.com> wrote:
>>> 
>>> Author: bogner
>>> Date: Mon Aug  4 12:36:41 2014
>>> New Revision: 214737
>>> 
>>> URL: http://llvm.org/viewvc/llvm-project?rev=214737&view=rev> Log:
>>> Path: Stop claiming path::const_iterator is bidirectional
>>> 
>>> path::const_iterator claims that it's a bidirectional iterator, but it
>>> doesn't satisfy all of the contracts for a bidirectional iterator.
>>> For example, n3376 24.2.5 p6 says "If a and b are both dereferenceable,
>>> then a == b if and only if *a and *b are bound to the same object",
>>> but this doesn't work with how we stash and recreate Components.
>>> 
>>> This means that our use of reverse_iterator on this type is invalid
>>> and leads to many of the valgrind errors we're hitting, as explained
>>> by Tilmann Scheller here:
>>> 
>>>   http://lists.cs.uiuc.edu/pipermail/llvm-commits/Week-of-Mon-20140728/228654.html> 
>>> Instead, we admit that path::const_iterator is only an input_iterator,
>> 
>> Is this really just an `input_iterator`?  I would have expected it to
>> be a `forward_iterator` at least.
> 
> Sadly, yes. The line from the standard I quoted above is in the
> forward_iterator contract.

Right, my bad.  Sad that the Boost iterator concept proposal [1] didn't
seem to make it past TR1.

[1]: http://www.boost.org/doc/libs/1_55_0/libs/iterator/doc/new-iter-concepts.html



More information about the llvm-commits mailing list