[clang] 48dc980 - [Format] Remove unused LineContainsContinuedForLoopSection. NFC

Sam McCall via cfe-commits cfe-commits at lists.llvm.org
Tue Feb 22 01:01:00 PST 2022


Author: Sam McCall
Date: 2022-02-22T09:59:02+01:00
New Revision: 48dc980847b25384511276e37c02c7edcf9e3d3a

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

LOG: [Format] Remove unused LineContainsContinuedForLoopSection. NFC

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

Added: 
    

Modified: 
    clang/lib/Format/ContinuationIndenter.cpp
    clang/lib/Format/ContinuationIndenter.h

Removed: 
    


################################################################################
diff  --git a/clang/lib/Format/ContinuationIndenter.cpp b/clang/lib/Format/ContinuationIndenter.cpp
index f4a755268eae8..ec268e74fd97e 100644
--- a/clang/lib/Format/ContinuationIndenter.cpp
+++ b/clang/lib/Format/ContinuationIndenter.cpp
@@ -253,7 +253,6 @@ LineState ContinuationIndenter::getInitialState(unsigned FirstIndent,
   State.Stack.push_back(ParenState(/*Tok=*/nullptr, FirstIndent, FirstIndent,
                                    /*AvoidBinPacking=*/false,
                                    /*NoLineBreak=*/false));
-  State.LineContainsContinuedForLoopSection = false;
   State.NoContinuation = false;
   State.StartOfStringLiteral = 0;
   State.StartOfLineLevel = 0;
@@ -343,8 +342,6 @@ bool ContinuationIndenter::mustBreak(const LineState &State) {
     return true;
   if (CurrentState.BreakBeforeClosingParen && Current.is(tok::r_paren))
     return true;
-  if (Previous.is(tok::semi) && State.LineContainsContinuedForLoopSection)
-    return true;
   if (Style.Language == FormatStyle::LK_ObjC &&
       Style.ObjCBreakBeforeNestedBlockParam &&
       Current.ObjCSelectorNameParts > 1 &&

diff  --git a/clang/lib/Format/ContinuationIndenter.h b/clang/lib/Format/ContinuationIndenter.h
index 0eb53cbd02937..494a9727d5edc 100644
--- a/clang/lib/Format/ContinuationIndenter.h
+++ b/clang/lib/Format/ContinuationIndenter.h
@@ -419,9 +419,6 @@ struct LineState {
   /// The token that needs to be next formatted.
   FormatToken *NextToken;
 
-  /// \c true if this line contains a continued for-loop section.
-  bool LineContainsContinuedForLoopSection;
-
   /// \c true if \p NextToken should not continue this line.
   bool NoContinuation;
 
@@ -468,9 +465,6 @@ struct LineState {
       return NextToken < Other.NextToken;
     if (Column != Other.Column)
       return Column < Other.Column;
-    if (LineContainsContinuedForLoopSection !=
-        Other.LineContainsContinuedForLoopSection)
-      return LineContainsContinuedForLoopSection;
     if (NoContinuation != Other.NoContinuation)
       return NoContinuation;
     if (StartOfLineLevel != Other.StartOfLineLevel)


        


More information about the cfe-commits mailing list