summaryrefslogtreecommitdiffstats
path: root/clang
diff options
context:
space:
mode:
authorDaniel Jasper <djasper@google.com>2015-11-23 15:55:45 +0000
committerDaniel Jasper <djasper@google.com>2015-11-23 15:55:45 +0000
commit253dad2323b4a9288d57f8d1fd63743fd979bde4 (patch)
treec101c7c1bf3bf3bd1b256855ae71f1f7086d4cd5 /clang
parent8a0654836e468650a2c2f7301e627db937a82118 (diff)
downloadbcm5719-llvm-253dad2323b4a9288d57f8d1fd63743fd979bde4.tar.gz
bcm5719-llvm-253dad2323b4a9288d57f8d1fd63743fd979bde4.zip
clang-format: If the template list of a variable declaration spans
multiple lines, also break before the variable name. Before: std::vector<aaaaaa, // wrap aa> aaa; After: std::vector<aaaaaa, // wrap aa> aaa; llvm-svn: 253871
Diffstat (limited to 'clang')
-rw-r--r--clang/lib/Format/ContinuationIndenter.cpp1
-rw-r--r--clang/unittests/Format/FormatTest.cpp3
2 files changed, 3 insertions, 1 deletions
diff --git a/clang/lib/Format/ContinuationIndenter.cpp b/clang/lib/Format/ContinuationIndenter.cpp
index 72157bd6415..e41ae9769af 100644
--- a/clang/lib/Format/ContinuationIndenter.cpp
+++ b/clang/lib/Format/ContinuationIndenter.cpp
@@ -144,6 +144,7 @@ bool ContinuationIndenter::mustBreak(const LineState &State) {
if (Previous.is(tok::semi) && State.LineContainsContinuedForLoopSection)
return true;
if ((startsNextParameter(Current, Style) || Previous.is(tok::semi) ||
+ (Previous.is(TT_TemplateCloser) && Current.is(TT_StartOfName)) ||
(Style.BreakBeforeTernaryOperators && Current.is(TT_ConditionalExpr) &&
Previous.isNot(tok::question)) ||
(!Style.BreakBeforeTernaryOperators &&
diff --git a/clang/unittests/Format/FormatTest.cpp b/clang/unittests/Format/FormatTest.cpp
index f0646c62e1e..66b3add3026 100644
--- a/clang/unittests/Format/FormatTest.cpp
+++ b/clang/unittests/Format/FormatTest.cpp
@@ -4080,7 +4080,8 @@ TEST_F(FormatTest, FormatsOneParameterPerLineIfNecessary) {
verifyFormat("std::vector<aaaaaaaaaaaaaaaaaaaaaaa,\n"
" aaaaaaaaaaaaaaaaaaaaaaa,\n"
- " aaaaaaaaaaaaaaaaaaaaaaa> aaaaaaaaaaaaaaaaaa;",
+ " aaaaaaaaaaaaaaaaaaaaaaa>\n"
+ " aaaaaaaaaaaaaaaaaa;",
NoBinPacking);
verifyFormat("a(\"a\"\n"
" \"a\",\n"
OpenPOWER on IntegriCloud