From 15b01116d90733c004b371960624f511f54d897a Mon Sep 17 00:00:00 2001 From: Daniel Jasper Date: Wed, 27 Jan 2016 20:14:23 +0000 Subject: [PATCH] clang-format: [Java] Remove unnecessary line break after complex annotations Before: @Annotation("Some" + " text") List list; After: @Annotation("Some" + " text") List list; llvm-svn: 258981 --- clang/lib/Format/ContinuationIndenter.cpp | 1 + clang/unittests/Format/FormatTestJava.cpp | 3 +++ 2 files changed, 4 insertions(+) diff --git a/clang/lib/Format/ContinuationIndenter.cpp b/clang/lib/Format/ContinuationIndenter.cpp index b820f53..07b90090 100644 --- a/clang/lib/Format/ContinuationIndenter.cpp +++ b/clang/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/clang/unittests/Format/FormatTestJava.cpp b/clang/unittests/Format/FormatTestJava.cpp index 8fadfc0..30d1bc8 100644 --- a/clang/unittests/Format/FormatTestJava.cpp +++ b/clang/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) { -- 2.7.4