summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--clang/lib/Format/TokenAnnotator.cpp2
-rw-r--r--clang/unittests/Format/FormatTest.cpp4
2 files changed, 6 insertions, 0 deletions
diff --git a/clang/lib/Format/TokenAnnotator.cpp b/clang/lib/Format/TokenAnnotator.cpp
index 0ac30a76ff4..017a8404ba4 100644
--- a/clang/lib/Format/TokenAnnotator.cpp
+++ b/clang/lib/Format/TokenAnnotator.cpp
@@ -1441,6 +1441,8 @@ unsigned TokenAnnotator::splitPenalty(const AnnotatedLine &Line,
return 110;
if (Right.is(tok::r_brace))
return 1;
+ if (Left.Type == TT_TemplateOpener)
+ return 100;
if (Left.opensScope())
return Left.ParameterCount > 1 ? Style.PenaltyBreakBeforeFirstCallParameter
: 19;
diff --git a/clang/unittests/Format/FormatTest.cpp b/clang/unittests/Format/FormatTest.cpp
index d8e20e9c2a1..73d17d39106 100644
--- a/clang/unittests/Format/FormatTest.cpp
+++ b/clang/unittests/Format/FormatTest.cpp
@@ -3428,6 +3428,10 @@ TEST_F(FormatTest, BreaksFunctionDeclarations) {
" int aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa = 1);");
verifyFormat("aaaaaaaaaaaaaaaaaaaaaa\n"
"aaaaaaaaaaaaaaaaaaaaaaaaa(int aaaaaaaaaaaaaaaaaaaaaaaa = 1);");
+ verifyGoogleFormat(
+ "typename aaaaaaaaaa<aaaaaa>::aaaaaaaaaaa\n"
+ "aaaaaaaaaa<aaaaaa>::aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa(\n"
+ " bool *aaaaaaaaaaaaaaaaaa, bool *aa) {}");
}
TEST_F(FormatTest, TrailingReturnType) {
OpenPOWER on IntegriCloud