diff options
author | Benjamin Kramer <benny.kra@googlemail.com> | 2016-04-11 12:19:19 +0000 |
---|---|---|
committer | Benjamin Kramer <benny.kra@googlemail.com> | 2016-04-11 12:19:19 +0000 |
commit | 5ffc24e20226267314e13b0f2b82afdf878305e4 (patch) | |
tree | 61f84e3282923f24dd2078b0fefa3129fb621a5a | |
parent | 848a513d0ae33f1b516ea487e15d84721aa8fe91 (diff) | |
download | bcm5719-llvm-5ffc24e20226267314e13b0f2b82afdf878305e4.tar.gz bcm5719-llvm-5ffc24e20226267314e13b0f2b82afdf878305e4.zip |
[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
-rw-r--r-- | clang/lib/Format/UnwrappedLineParser.cpp | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/clang/lib/Format/UnwrappedLineParser.cpp b/clang/lib/Format/UnwrappedLineParser.cpp index b25abeae937..76e87768bc6 100644 --- a/clang/lib/Format/UnwrappedLineParser.cpp +++ b/clang/lib/Format/UnwrappedLineParser.cpp @@ -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; } |