[clang-format] Fix Bug 41407
Differential Revision: https://reviews.llvm.org/D60359 llvm-svn: 357851
This commit is contained in:
parent
bcb29cb748
commit
fca07890a9
|
@ -1057,7 +1057,7 @@ unsigned ContinuationIndenter::getNewLineColumn(const LineState &State) {
|
|||
if (Current.is(TT_ProtoExtensionLSquare))
|
||||
return State.Stack.back().Indent;
|
||||
if (State.Stack.back().Indent == State.FirstIndent && PreviousNonComment &&
|
||||
PreviousNonComment->isNot(tok::r_brace))
|
||||
!PreviousNonComment->isOneOf(tok::r_brace, TT_CtorInitializerComma))
|
||||
// Ensure that we fall back to the continuation indent width instead of
|
||||
// just flushing continuations left.
|
||||
return State.Stack.back().Indent + Style.ContinuationIndentWidth;
|
||||
|
|
|
@ -11946,6 +11946,13 @@ TEST_F(FormatTest, ConstructorInitializerIndentWidth) {
|
|||
"bool smaller = 1 < bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb(\n"
|
||||
" aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa);",
|
||||
Style);
|
||||
|
||||
Style.BreakConstructorInitializers = FormatStyle::BCIS_AfterColon;
|
||||
verifyFormat(
|
||||
"SomeClass::Constructor() :\n"
|
||||
"aaaaaaaaaaaaaaaaaaaa(aaaaaaaaaaaaaaaaaaaa),\n"
|
||||
"aaaaaaaaaaaaaaaaaaaa(aaaaaaaaaaaaaaaaaaaa) {}",
|
||||
Style);
|
||||
}
|
||||
|
||||
TEST_F(FormatTest, BreakConstructorInitializersBeforeComma) {
|
||||
|
|
Loading…
Reference in New Issue