r265934 - [clang-format] Walk backwards from end() instead of forwards from rend().

Martin Probst via cfe-commits cfe-commits at lists.llvm.org
Mon Apr 11 14:15:33 PDT 2016


>
> > Was/is the 2 correct then? (if it was next(rbegin, 2) that'd be
> equivalent
> > to prev(end, 3), yes?)
>
> I think it is from looking at the test case, looping in martin to see
> whether I'm right :)


At that point in the code, we have [..., PrePrev = '@', Prev = 'SomeToken']
and CurrentToken = 'Whatever', CurrentToken has not been appended to the
list yet. So moving two from the end should be correct.

I don't quite understand why rend() actually works in my code with the unit
tests. Is that some unintentional side effect of its implementation
leaking? I think I explicitly confirmed that my test does test what it's
trying to test.

Martin
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20160411/3fe9bf7f/attachment.html>


More information about the cfe-commits mailing list