summaryrefslogtreecommitdiffstats
path: root/clang/lib
diff options
context:
space:
mode:
authorDaniel Jasper <djasper@google.com>2017-01-12 20:06:28 +0000
committerDaniel Jasper <djasper@google.com>2017-01-12 20:06:28 +0000
commite37101076c7b742ce2831f7ece3b7a881c9fe49e (patch)
tree4f5170340dda5720d6725d9cb35eef68bd7b80f4 /clang/lib
parentf02ac0eeb2beadef8d5fe5e480dbbf64150b214a (diff)
downloadbcm5719-llvm-e37101076c7b742ce2831f7ece3b7a881c9fe49e.tar.gz
bcm5719-llvm-e37101076c7b742ce2831f7ece3b7a881c9fe49e.zip
clang-format: Fix regression introduced by r291801.
Uncovered by polly tests. Before: aaaaaaaaaaaaaaaaaaaaaaaaaaaaaa(aaaaaaaaaaaaaaaaaaa, {}, aaaaaaaaaaaaaaaaaaaaaaa); After: aaaaaaaaaaaaaaaaaaaaaaaaaaaaaa(aaaaaaaaaaaaaaaaaaa, {}, aaaaaaaaaaaaaaaaaaaaaaa); llvm-svn: 291807
Diffstat (limited to 'clang/lib')
-rw-r--r--clang/lib/Format/ContinuationIndenter.cpp12
1 files changed, 4 insertions, 8 deletions
diff --git a/clang/lib/Format/ContinuationIndenter.cpp b/clang/lib/Format/ContinuationIndenter.cpp
index 5a30370af86..6bb6fb30603 100644
--- a/clang/lib/Format/ContinuationIndenter.cpp
+++ b/clang/lib/Format/ContinuationIndenter.cpp
@@ -930,13 +930,6 @@ void ContinuationIndenter::moveStatePastScopeOpener(LineState &State,
return;
}
- const FormatToken *Previous = Current.getPreviousNonComment();
- if (Previous && Previous->is(tok::comma) &&
- !Previous->is(TT_OverloadedOperator)) {
- if (!Newline)
- State.Stack.back().NoLineBreak = true;
- }
-
unsigned NewIndent;
unsigned NewIndentLevel = State.Stack.back().IndentLevel;
unsigned LastSpace = State.Stack.back().LastSpace;
@@ -1010,12 +1003,15 @@ void ContinuationIndenter::moveStatePastScopeOpener(LineState &State,
// Generally inherit NoLineBreak from the current scope to nested scope.
// However, don't do this for non-empty nested blocks, dict literals and
// array literals as these follow different indentation rules.
+ const FormatToken *Previous = Current.getPreviousNonComment();
bool NoLineBreak =
Current.Children.empty() &&
!Current.isOneOf(TT_DictLiteral, TT_ArrayInitializerLSquare) &&
(State.Stack.back().NoLineBreak ||
(Current.is(TT_TemplateOpener) &&
- State.Stack.back().ContainsUnwrappedBuilder));
+ State.Stack.back().ContainsUnwrappedBuilder) ||
+ (Current.is(tok::l_brace) && !Newline && Previous &&
+ Previous->is(tok::comma)));
State.Stack.push_back(ParenState(NewIndent, NewIndentLevel, LastSpace,
AvoidBinPacking, NoLineBreak));
State.Stack.back().NestedBlockIndent = NestedBlockIndent;
OpenPOWER on IntegriCloud