diff options
author | Daniel Jasper <djasper@google.com> | 2014-04-14 12:05:05 +0000 |
---|---|---|
committer | Daniel Jasper <djasper@google.com> | 2014-04-14 12:05:05 +0000 |
commit | af4fee2636b304ed86e8d05d8f076219d595b54c (patch) | |
tree | 195ca2bc9794fc9a4d766aaea3971f1a1ee63138 /clang/lib/Format/ContinuationIndenter.cpp | |
parent | 90527cb3249f353ac0f67d923c484ee949e3c939 (diff) | |
download | bcm5719-llvm-af4fee2636b304ed86e8d05d8f076219d595b54c.tar.gz bcm5719-llvm-af4fee2636b304ed86e8d05d8f076219d595b54c.zip |
clang-format: With ColumnLimit=0, keep short array literals on a line.
Before:
NSArray* a = [[NSArray alloc] initWithArray:@[
@"a"
]
copyItems:YES];
After:
NSArray* a = [[NSArray alloc] initWithArray:@[ @"a" ]
copyItems:YES];
This fixed llvm.org/PR19080.
llvm-svn: 206161
Diffstat (limited to 'clang/lib/Format/ContinuationIndenter.cpp')
-rw-r--r-- | clang/lib/Format/ContinuationIndenter.cpp | 1 |
1 files changed, 1 insertions, 0 deletions
diff --git a/clang/lib/Format/ContinuationIndenter.cpp b/clang/lib/Format/ContinuationIndenter.cpp index 53b58679651..43997f99576 100644 --- a/clang/lib/Format/ContinuationIndenter.cpp +++ b/clang/lib/Format/ContinuationIndenter.cpp @@ -142,6 +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) && getLengthToMatchingParen(Previous) + State.Column > getColumnLimit(State)) return true; if (Current.Type == TT_CtorInitializerColon && |