[clang] 9dad527 - [clang-format] Use range-for loop with drop_end. NFC.

Marek Kurdej via cfe-commits cfe-commits at lists.llvm.org
Mon Mar 21 02:05:48 PDT 2022


Author: Marek Kurdej
Date: 2022-03-21T10:05:06+01:00
New Revision: 9dad527fc048e9f6df6783abb1d6251e77f12199

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

LOG: [clang-format] Use range-for loop with drop_end. NFC.

Added: 
    

Modified: 
    clang/lib/Format/ContinuationIndenter.cpp

Removed: 
    


################################################################################
diff  --git a/clang/lib/Format/ContinuationIndenter.cpp b/clang/lib/Format/ContinuationIndenter.cpp
index 69508c44dc436..e3d54a0ba42a4 100644
--- a/clang/lib/Format/ContinuationIndenter.cpp
+++ b/clang/lib/Format/ContinuationIndenter.cpp
@@ -954,8 +954,8 @@ unsigned ContinuationIndenter::addTokenOnNewLine(LineState &State,
       (Current.MatchingParen &&
        Current.MatchingParen->is(TT_RequiresExpressionLBrace));
   if (!NestedBlockSpecialCase)
-    for (unsigned i = 0, e = State.Stack.size() - 1; i != e; ++i)
-      State.Stack[i].BreakBeforeParameter = true;
+    for (ParenState &PState : llvm::drop_end(State.Stack))
+      PState.BreakBeforeParameter = true;
 
   if (PreviousNonComment &&
       !PreviousNonComment->isOneOf(tok::comma, tok::colon, tok::semi) &&
@@ -1340,8 +1340,8 @@ unsigned ContinuationIndenter::moveStateToNextToken(LineState &State,
       !Previous->is(TT_DictLiteral) && State.Stack.size() > 1 &&
       !CurrentState.HasMultipleNestedBlocks) {
     if (State.Stack[State.Stack.size() - 2].NestedBlockInlined && Newline)
-      for (unsigned i = 0, e = State.Stack.size() - 1; i != e; ++i)
-        State.Stack[i].NoLineBreak = true;
+      for (ParenState &PState : llvm::drop_end(State.Stack))
+        PState.NoLineBreak = true;
     State.Stack[State.Stack.size() - 2].NestedBlockInlined = false;
   }
   if (Previous && (Previous->isOneOf(TT_BinaryOperator, TT_ConditionalExpr) ||


        


More information about the cfe-commits mailing list