From: Daniel Jasper Date: Thu, 20 Nov 2014 09:48:11 +0000 (+0000) Subject: clang-format: [Java] Don't force break before generic type method. X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=caf86859586eb87eeaa11355bc45369d088ff22b;p=platform%2Fupstream%2Fllvm.git clang-format: [Java] Don't force break before generic type method. Before: Foo.bar() . baz(); After: Foo.bar() .baz(); Patch by Harry Terkelsen. llvm-svn: 222423 --- diff --git a/clang/lib/Format/TokenAnnotator.cpp b/clang/lib/Format/TokenAnnotator.cpp index f9da8c9..1afdb19 100644 --- a/clang/lib/Format/TokenAnnotator.cpp +++ b/clang/lib/Format/TokenAnnotator.cpp @@ -878,6 +878,7 @@ private: if (PreviousNotConst->Type == TT_TemplateCloser) return PreviousNotConst && PreviousNotConst->MatchingParen && PreviousNotConst->MatchingParen->Previous && + PreviousNotConst->MatchingParen->Previous->isNot(tok::period) && PreviousNotConst->MatchingParen->Previous->isNot(tok::kw_template); if (PreviousNotConst->is(tok::r_paren) && PreviousNotConst->MatchingParen && diff --git a/clang/unittests/Format/FormatTestJava.cpp b/clang/unittests/Format/FormatTestJava.cpp index 5c9bf1a..94070f4 100644 --- a/clang/unittests/Format/FormatTestJava.cpp +++ b/clang/unittests/Format/FormatTestJava.cpp @@ -234,6 +234,13 @@ TEST_F(FormatTestJava, Generics) { verifyFormat("private Foo[] foos;"); verifyFormat("Foo[] foos = this.foos;"); + + verifyFormat( + "SomeLoooooooooooooooooooooongType name =\n" + " SomeType.foo(someArgument)\n" + " .method()\n" + " .aaaaaaaaaaaaaaaaaaa()\n" + " .aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa();"); } TEST_F(FormatTestJava, StringConcatenation) {