This revision was not accepted when it landed; it landed in state "Needs 
Review".
This revision was automatically updated to reflect the committed changes.
Closed by commit rC332225: [clang-format] Continue after non-scope-closers in 
getLengthToMatchingParen (authored by krasimir, committed by ).

Changed prior to commit:
  https://reviews.llvm.org/D46824?vs=146569&id=146570#toc

Repository:
  rC Clang

https://reviews.llvm.org/D46824

Files:
  lib/Format/ContinuationIndenter.cpp
  unittests/Format/FormatTestObjC.cpp


Index: lib/Format/ContinuationIndenter.cpp
===================================================================
--- lib/Format/ContinuationIndenter.cpp
+++ lib/Format/ContinuationIndenter.cpp
@@ -90,8 +90,10 @@
     return MatchingStackIndex >= 0 ? &Stack[MatchingStackIndex] : nullptr;
   };
   for (; End->Next; End = End->Next) {
-    if (End->Next->CanBreakBefore || !End->Next->closesScope())
+    if (End->Next->CanBreakBefore)
       break;
+    if (!End->Next->closesScope())
+      continue;
     if (End->Next->MatchingParen->isOneOf(tok::l_brace,
                                           TT_ArrayInitializerLSquare,
                                           tok::less)) {
Index: unittests/Format/FormatTestObjC.cpp
===================================================================
--- unittests/Format/FormatTestObjC.cpp
+++ unittests/Format/FormatTestObjC.cpp
@@ -1142,6 +1142,18 @@
                "  @\"aaaaaaaaaaaaaaaaaaaaaaaaaa\"\n"
                "];\n");
 }
+
+TEST_F(FormatTestObjC, BreaksCallStatementWhereSemiJustOverTheLimit) {
+  Style.ColumnLimit = 60;
+  // If the statement starting with 'a = ...' is put on a single line, the ';'
+  // is at line 61.
+  verifyFormat("int f(int a) {\n"
+               "  a = [self aaaaaaaaaa:bbbbbbbbb\n"
+               "             ccccccccc:dddddddd\n"
+               "                    ee:fddd];\n"
+               "}");
+}
+
 } // end namespace
 } // end namespace format
 } // end namespace clang


Index: lib/Format/ContinuationIndenter.cpp
===================================================================
--- lib/Format/ContinuationIndenter.cpp
+++ lib/Format/ContinuationIndenter.cpp
@@ -90,8 +90,10 @@
     return MatchingStackIndex >= 0 ? &Stack[MatchingStackIndex] : nullptr;
   };
   for (; End->Next; End = End->Next) {
-    if (End->Next->CanBreakBefore || !End->Next->closesScope())
+    if (End->Next->CanBreakBefore)
       break;
+    if (!End->Next->closesScope())
+      continue;
     if (End->Next->MatchingParen->isOneOf(tok::l_brace,
                                           TT_ArrayInitializerLSquare,
                                           tok::less)) {
Index: unittests/Format/FormatTestObjC.cpp
===================================================================
--- unittests/Format/FormatTestObjC.cpp
+++ unittests/Format/FormatTestObjC.cpp
@@ -1142,6 +1142,18 @@
                "  @\"aaaaaaaaaaaaaaaaaaaaaaaaaa\"\n"
                "];\n");
 }
+
+TEST_F(FormatTestObjC, BreaksCallStatementWhereSemiJustOverTheLimit) {
+  Style.ColumnLimit = 60;
+  // If the statement starting with 'a = ...' is put on a single line, the ';'
+  // is at line 61.
+  verifyFormat("int f(int a) {\n"
+               "  a = [self aaaaaaaaaa:bbbbbbbbb\n"
+               "             ccccccccc:dddddddd\n"
+               "                    ee:fddd];\n"
+               "}");
+}
+
 } // end namespace
 } // end namespace format
 } // end namespace clang
_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
  • [PATCH] D46824: [clang-f... Krasimir Georgiev via Phabricator via cfe-commits
    • [PATCH] D46824: [cl... Krasimir Georgiev via Phabricator via cfe-commits

Reply via email to