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

Justin Bogner mail at justinbogner.com
Mon Aug 4 11:33:39 PDT 2014


"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.

> Also, can these take advantage of `iterator_facade_base`?

They might be able to - I hadn't realized we have that. I'll take a look
when I get a chance.



More information about the llvm-commits mailing list