[clang] c25536e - [clang-format][NFC] Use range based for

Björn Schäpers via cfe-commits cfe-commits at lists.llvm.org
Sat Dec 4 12:30:16 PST 2021


Author: Björn Schäpers
Date: 2021-12-04T21:29:30+01:00
New Revision: c25536e4feed59f8a8685fac3ba225057b76a358

URL: https://github.com/llvm/llvm-project/commit/c25536e4feed59f8a8685fac3ba225057b76a358
DIFF: https://github.com/llvm/llvm-project/commit/c25536e4feed59f8a8685fac3ba225057b76a358.diff

LOG: [clang-format][NFC] Use range based for

That's much easier to read.

Differential Revision: https://reviews.llvm.org/D115067

Added: 
    

Modified: 
    clang/lib/Format/TokenAnnotator.cpp

Removed: 
    


################################################################################
diff  --git a/clang/lib/Format/TokenAnnotator.cpp b/clang/lib/Format/TokenAnnotator.cpp
index cc6d0662c9d1..6b7f135e3213 100644
--- a/clang/lib/Format/TokenAnnotator.cpp
+++ b/clang/lib/Format/TokenAnnotator.cpp
@@ -2373,11 +2373,9 @@ static unsigned maxNestingDepth(const AnnotatedLine &Line) {
 }
 
 void TokenAnnotator::annotate(AnnotatedLine &Line) {
-  for (SmallVectorImpl<AnnotatedLine *>::iterator I = Line.Children.begin(),
-                                                  E = Line.Children.end();
-       I != E; ++I) {
-    annotate(**I);
-  }
+  for (auto &Child : Line.Children)
+    annotate(*Child);
+
   AnnotatingParser Parser(Style, Line, Keywords);
   Line.Type = Parser.parseLine();
 


        


More information about the cfe-commits mailing list