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

This should've been forwards from rbegin(), reverse iterators are just
too confusing to be used by mere mortals. Fixes out-of-bounds walks over
the list.

llvm-svn: 265934
This commit is contained in:
Benjamin Kramer 2016-04-11 12:19:19 +00:00
parent 848a513d0a
commit 5ffc24e202
1 changed files with 1 additions and 1 deletions

View File

@ -718,7 +718,7 @@ void UnwrappedLineParser::readTokenWithJavaScriptASI() {
if (PreviousMustBeValue && Line && Line->Tokens.size() > 1) {
// If the token before the previous one is an '@', the previous token is an
// annotation and can precede another identifier/value.
const FormatToken *PrePrevious = std::next(Line->Tokens.rend(), 2)->Tok;
const FormatToken *PrePrevious = std::prev(Line->Tokens.end(), 2)->Tok;
if (PrePrevious->is(tok::at))
return;
}