[llvm-dev] arg_iterator missing inc/dec operators

Dmitry Babokin via llvm-dev llvm-dev at lists.llvm.org
Wed Mar 22 13:23:36 PDT 2017


Reid,

std::prev() works, though IMHO increment/decrement are more conventional
way (I'm not saying better) to work with iterators.

I have no problem fixing code on my side, I'm just bringing your attention
that code like this is broken. If your judgement is to keep it the way it
is now, I'm ok with it.

Thanks.

Dmitry.

On Wed, Mar 22, 2017 at 1:20 PM, Reid Kleckner <rnk at google.com> wrote:

> On Wed, Mar 22, 2017 at 1:12 PM, Dmitry Babokin <babokin at gmail.com> wrote:
>
>> Correct, I mean exactly this. Though &* is not important in this case.
>>
>> This code doesn't work anymore, as arg_iterator is defined differently
>> now: https://github.com/llvm-mirror/llvm/blob/master/include
>> /llvm/IR/Function.h#L57
>>
>> I get an error when I'm using pre-decrement operator:
>> error: expression is not assignable
>>       --f->arg_end();
>>
>
> Today's arg_iterator is now just an Argument*, which is the world's
> simplest iterator. The '--f->arg_end()' snippet only compiled before this
> change because we used to use fancy ilist iterators which had overloaded
> decrement operators.
>
> I don't think we should make a wrapper pointer iterator type just to make
> old code like this compile.
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20170322/be37a51d/attachment.html>


More information about the llvm-dev mailing list