summaryrefslogtreecommitdiffstats
path: root/clang
diff options
context:
space:
mode:
Diffstat (limited to 'clang')
-rw-r--r--clang/lib/Format/ContinuationIndenter.cpp2
-rw-r--r--clang/unittests/Format/FormatTest.cpp21
2 files changed, 16 insertions, 7 deletions
diff --git a/clang/lib/Format/ContinuationIndenter.cpp b/clang/lib/Format/ContinuationIndenter.cpp
index 43997f99576..0ad8c1eb419 100644
--- a/clang/lib/Format/ContinuationIndenter.cpp
+++ b/clang/lib/Format/ContinuationIndenter.cpp
@@ -142,7 +142,7 @@ bool ContinuationIndenter::mustBreak(const LineState &State) {
return true;
if (((Previous.Type == TT_DictLiteral && Previous.is(tok::l_brace)) ||
Previous.Type == TT_ArrayInitializerLSquare) &&
- (Style.ColumnLimit > 0 || Previous.ParameterCount > 1) &&
+ Style.ColumnLimit > 0 &&
getLengthToMatchingParen(Previous) + State.Column > getColumnLimit(State))
return true;
if (Current.Type == TT_CtorInitializerColon &&
diff --git a/clang/unittests/Format/FormatTest.cpp b/clang/unittests/Format/FormatTest.cpp
index 7bae21b89e6..f829dccbe98 100644
--- a/clang/unittests/Format/FormatTest.cpp
+++ b/clang/unittests/Format/FormatTest.cpp
@@ -8156,12 +8156,21 @@ TEST_F(FormatTest, FormatsWithWebKitStyle) {
verifyFormat("NSArray* a = [[NSArray alloc] initWithArray:@[ @\"a\" ]\n"
" copyItems:YES];",
Style);
- verifyFormat("NSArray* a = [[NSArray alloc] initWithArray:@[\n"
- " @\"a\",\n"
- " @\"a\"\n"
- " ]\n"
- " copyItems:YES];",
- Style);
+ EXPECT_EQ("NSArray* a = [[NSArray alloc] initWithArray:@[\n"
+ " @\"a\",\n"
+ " @\"a\"\n"
+ " ]\n"
+ " copyItems:YES];",
+ format("NSArray* a = [[NSArray alloc] initWithArray:@[\n"
+ " @\"a\",\n"
+ " @\"a\"\n"
+ " ]\n"
+ " copyItems:YES];",
+ Style));
+ verifyFormat(
+ "NSArray* a = [[NSArray alloc] initWithArray:@[ @\"a\", @\"a\" ]\n"
+ " copyItems:YES];",
+ Style);
}
TEST_F(FormatTest, FormatsLambdas) {
OpenPOWER on IntegriCloud