From: Daniel Jasper Date: Wed, 27 Jan 2016 20:14:23 +0000 (+0000) Subject: clang-format: [Java] Remove unnecessary line break after complex annotations X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=7252bd2d5735df1b96ce56aef00ff4fd18cb24bf;p=clang clang-format: [Java] Remove unnecessary line break after complex annotations Before: @Annotation("Some" + " text") List list; After: @Annotation("Some" + " text") List list; git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@258981 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/lib/Format/ContinuationIndenter.cpp b/lib/Format/ContinuationIndenter.cpp index b820f53db5..07b90090ac 100644 --- a/lib/Format/ContinuationIndenter.cpp +++ b/lib/Format/ContinuationIndenter.cpp @@ -151,6 +151,7 @@ bool ContinuationIndenter::mustBreak(const LineState &State) { return true; if ((startsNextParameter(Current, Style) || Previous.is(tok::semi) || (Previous.is(TT_TemplateCloser) && Current.is(TT_StartOfName) && + Style.Language == FormatStyle::LK_Cpp && // FIXME: This is a temporary workaround for the case where clang-format // sets BreakBeforeParameter to avoid bin packing and this creates a // completely unnecessary line break after a template type that isn't diff --git a/unittests/Format/FormatTestJava.cpp b/unittests/Format/FormatTestJava.cpp index 8fadfc09b3..30d1bc8baf 100644 --- a/unittests/Format/FormatTestJava.cpp +++ b/unittests/Format/FormatTestJava.cpp @@ -312,6 +312,9 @@ TEST_F(FormatTestJava, Annotations) { " String bbbbbbbbbbbbbbb) {}\n" "}", getStyleWithColumns(60)); + verifyFormat("@Annotation(\"Some\"\n" + " + \" text\")\n" + "List list;"); } TEST_F(FormatTestJava, Generics) {