From 5ffcb7fe908166911891c697d56a582b4a836bf0 Mon Sep 17 00:00:00 2001 From: Daniel Jasper Date: Tue, 21 Oct 2014 11:13:31 +0000 Subject: [PATCH] clang-format: [Java] Fix space in generic method calls. Before: A.doSomething(); After: A.doSomething(); llvm-svn: 220285 --- clang/lib/Format/TokenAnnotator.cpp | 5 +++++ clang/unittests/Format/FormatTestJava.cpp | 2 ++ 2 files changed, 7 insertions(+) diff --git a/clang/lib/Format/TokenAnnotator.cpp b/clang/lib/Format/TokenAnnotator.cpp index 9adec61..4b39b50 100644 --- a/clang/lib/Format/TokenAnnotator.cpp +++ b/clang/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/clang/unittests/Format/FormatTestJava.cpp b/clang/unittests/Format/FormatTestJava.cpp index afc13cf..f7d85fc 100644 --- a/clang/unittests/Format/FormatTestJava.cpp +++ b/clang/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 -- 2.7.4