[clang-tools-extra] r215195 - [clang-tidy] Don't index past the end of a vector.
Benjamin Kramer
benny.kra at googlemail.com
Fri Aug 8 03:43:11 PDT 2014
Author: d0k
Date: Fri Aug 8 05:43:11 2014
New Revision: 215195
URL: http://llvm.org/viewvc/llvm-project?rev=215195&view=rev
Log:
[clang-tidy] Don't index past the end of a vector.
We actually want the end iterator so just replace it with iterator arithmetic.
Modified:
clang-tools-extra/trunk/clang-tidy/llvm/IncludeOrderCheck.cpp
Modified: clang-tools-extra/trunk/clang-tidy/llvm/IncludeOrderCheck.cpp
URL: http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/clang-tidy/llvm/IncludeOrderCheck.cpp?rev=215195&r1=215194&r2=215195&view=diff
==============================================================================
--- clang-tools-extra/trunk/clang-tidy/llvm/IncludeOrderCheck.cpp (original)
+++ clang-tools-extra/trunk/clang-tidy/llvm/IncludeOrderCheck.cpp Fri Aug 8 05:43:11 2014
@@ -107,7 +107,8 @@ void IncludeOrderPPCallbacks::EndOfMainF
// Sort the includes. We first sort by priority, then lexicographically.
for (unsigned BI = 0, BE = Blocks.size() - 1; BI != BE; ++BI)
- std::sort(&IncludeIndices[Blocks[BI]], &IncludeIndices[Blocks[BI + 1]],
+ std::sort(IncludeIndices.begin() + Blocks[BI],
+ IncludeIndices.begin() + Blocks[BI + 1],
[this](unsigned LHSI, unsigned RHSI) {
IncludeDirective &LHS = IncludeDirectives[LHSI];
IncludeDirective &RHS = IncludeDirectives[RHSI];
More information about the cfe-commits
mailing list