[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:
parent
848a513d0a
commit
5ffc24e202
|
@ -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;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue