diff --git a/clang/docs/ClangFormatStyleOptions.rst b/clang/docs/ClangFormatStyleOptions.rst index 50b4ff5d901059..1c1d0142930ff9 100644 --- a/clang/docs/ClangFormatStyleOptions.rst +++ b/clang/docs/ClangFormatStyleOptions.rst @@ -2072,8 +2072,8 @@ the configuration (without a prefix: ``Auto``). - (void)_aMethod { [self.test1 t:self - w:self - callback:^(typeof(self) self, NSNumber *u, NSNumber *v) { + w:self + callback:^(typeof(self) self, NSNumber *u, NSNumber *v) { u = c; }] } diff --git a/clang/lib/Format/ContinuationIndenter.cpp b/clang/lib/Format/ContinuationIndenter.cpp index ba42ba0ca05002..03e79a22954e80 100644 --- a/clang/lib/Format/ContinuationIndenter.cpp +++ b/clang/lib/Format/ContinuationIndenter.cpp @@ -342,6 +342,7 @@ bool ContinuationIndenter::mustBreak(const LineState &State) { if (Previous.is(tok::semi) && State.LineContainsContinuedForLoopSection) return true; if (Style.Language == FormatStyle::LK_ObjC && + Style.ObjCBreakBeforeNestedBlockParam && Current.ObjCSelectorNameParts > 1 && Current.startsSequence(TT_SelectorName, tok::colon, tok::caret)) { return true; diff --git a/clang/unittests/Format/FormatTestObjC.cpp b/clang/unittests/Format/FormatTestObjC.cpp index edbf092d0421dc..42e2a80783be64 100644 --- a/clang/unittests/Format/FormatTestObjC.cpp +++ b/clang/unittests/Format/FormatTestObjC.cpp @@ -1420,6 +1420,10 @@ TEST_F(FormatTestObjC, BreakLineBeforeNestedBlockParam) { "*b, NSNumber *c) {\n" " b = c;\n" "}]"); + verifyFormat("[self.test1 t:self w:self callback:^(typeof(self) self, " + "NSNumber *u, NSNumber *v) {\n" + " u = v;\n" + "} z:self]"); Style.ColumnLimit = 80; verifyFormat(