<div dir="ltr"><br><div class="gmail_extra"><br><div class="gmail_quote">On Mon, Apr 11, 2016 at 5:19 AM, Benjamin Kramer via cfe-commits <span dir="ltr"><<a href="mailto:cfe-commits@lists.llvm.org" target="_blank">cfe-commits@lists.llvm.org</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Author: d0k<br>
Date: Mon Apr 11 07:19:19 2016<br>
New Revision: 265934<br>
<br>
URL: <a href="http://llvm.org/viewvc/llvm-project?rev=265934&view=rev" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-project?rev=265934&view=rev</a><br>
Log:<br>
[clang-format] Walk backwards from end() instead of forwards from rend().<br>
<br>
This should've been forwards from rbegin(), reverse iterators are just<br>
too confusing to be used by mere mortals. Fixes out-of-bounds walks over<br>
the list.<br></blockquote><div><br></div><div>Was/is the 2 correct then? (if it was next(rbegin, 2) that'd be equivalent to prev(end, 3), yes?)</div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<br>
Modified:<br>
cfe/trunk/lib/Format/UnwrappedLineParser.cpp<br>
<br>
Modified: cfe/trunk/lib/Format/UnwrappedLineParser.cpp<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Format/UnwrappedLineParser.cpp?rev=265934&r1=265933&r2=265934&view=diff" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Format/UnwrappedLineParser.cpp?rev=265934&r1=265933&r2=265934&view=diff</a><br>
==============================================================================<br>
--- cfe/trunk/lib/Format/UnwrappedLineParser.cpp (original)<br>
+++ cfe/trunk/lib/Format/UnwrappedLineParser.cpp Mon Apr 11 07:19:19 2016<br>
@@ -718,7 +718,7 @@ void UnwrappedLineParser::readTokenWithJ<br>
if (PreviousMustBeValue && Line && Line->Tokens.size() > 1) {<br>
// If the token before the previous one is an '@', the previous token is an<br>
// annotation and can precede another identifier/value.<br>
- const FormatToken *PrePrevious = std::next(Line->Tokens.rend(), 2)->Tok;<br>
+ const FormatToken *PrePrevious = std::prev(Line->Tokens.end(), 2)->Tok;<br>
if (PrePrevious->is(tok::at))<br>
return;<br>
}<br>
<br>
<br>
_______________________________________________<br>
cfe-commits mailing list<br>
<a href="mailto:cfe-commits@lists.llvm.org">cfe-commits@lists.llvm.org</a><br>
<a href="http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits" rel="noreferrer" target="_blank">http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits</a><br>
</blockquote></div><br></div></div>