From: Daniel Jasper Date: Tue, 21 Oct 2014 11:13:31 +0000 (+0000) Subject: clang-format: [Java] Fix space in generic method calls. X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=e4e2dd593d9ece5fe43d6acb3f0cff4439a0ae17;p=clang clang-format: [Java] Fix space in generic method calls. Before: A.doSomething(); After: A.doSomething(); git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@220285 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/lib/Format/TokenAnnotator.cpp b/lib/Format/TokenAnnotator.cpp index 9adec611f2..4b39b50735 100644 --- a/lib/Format/TokenAnnotator.cpp +++ b/lib/Format/TokenAnnotator.cpp @@ -1628,6 +1628,11 @@ bool TokenAnnotator::spaceRequiredBetween(const AnnotatedLine &Line, return false; if (Right.is(tok::hash) && Left.is(tok::identifier) && Left.TokenText == "L") return false; + if (Left.Type == TT_TemplateCloser && Left.MatchingParen && + Left.MatchingParen->Previous && + Left.MatchingParen->Previous->is(tok::period)) + // A.DoSomething(); + return false; return true; } diff --git a/unittests/Format/FormatTestJava.cpp b/unittests/Format/FormatTestJava.cpp index afc13cfbf6..f7d85fc4a0 100644 --- a/unittests/Format/FormatTestJava.cpp +++ b/unittests/Format/FormatTestJava.cpp @@ -90,6 +90,8 @@ TEST_F(FormatTestJava, Generics) { verifyFormat("Iterable a;"); verifyFormat("Iterable a;"); verifyFormat("Iterable a;"); + + verifyFormat("A.doSomething();"); } } // end namespace tooling