summaryrefslogtreecommitdiff
path: root/clang/lib/Format/TokenAnalyzer.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'clang/lib/Format/TokenAnalyzer.cpp')
-rw-r--r--clang/lib/Format/TokenAnalyzer.cpp10
1 files changed, 5 insertions, 5 deletions
diff --git a/clang/lib/Format/TokenAnalyzer.cpp b/clang/lib/Format/TokenAnalyzer.cpp
index d0754e0c1112..2bd5a1fd6230 100644
--- a/clang/lib/Format/TokenAnalyzer.cpp
+++ b/clang/lib/Format/TokenAnalyzer.cpp
@@ -113,12 +113,13 @@ std::pair<tooling::Replacements, unsigned> TokenAnalyzer::process() {
assert(UnwrappedLines.rbegin()->empty());
unsigned Penalty = 0;
for (unsigned Run = 0, RunE = UnwrappedLines.size(); Run + 1 != RunE; ++Run) {
+ const auto &Lines = UnwrappedLines[Run];
LLVM_DEBUG(llvm::dbgs() << "Run " << Run << "...\n");
SmallVector<AnnotatedLine *, 16> AnnotatedLines;
TokenAnnotator Annotator(Style, Lex.getKeywords());
- for (unsigned i = 0, e = UnwrappedLines[Run].size(); i != e; ++i) {
- AnnotatedLines.push_back(new AnnotatedLine(UnwrappedLines[Run][i]));
+ for (const UnwrappedLine &Line : Lines) {
+ AnnotatedLines.push_back(new AnnotatedLine(Line));
Annotator.annotate(*AnnotatedLines.back());
}
@@ -130,9 +131,8 @@ std::pair<tooling::Replacements, unsigned> TokenAnalyzer::process() {
for (const tooling::Replacement &Fix : RunResult.first)
llvm::dbgs() << Fix.toString() << "\n";
});
- for (unsigned i = 0, e = AnnotatedLines.size(); i != e; ++i) {
- delete AnnotatedLines[i];
- }
+ for (AnnotatedLine *Line : AnnotatedLines)
+ delete Line;
Penalty += RunResult.second;
for (const auto &R : RunResult.first) {