diff options
author | Owen Pan <owenpiano@gmail.com> | 2019-04-06 23:10:11 +0000 |
---|---|---|
committer | Owen Pan <owenpiano@gmail.com> | 2019-04-06 23:10:11 +0000 |
commit | fca07890a9918e9814a7c3d6a39ea3a91789b546 (patch) | |
tree | 6f4ca2aaf7713a9bdb68936ad4855bc577c60d28 | |
parent | bcb29cb7486280197853d1c07ec847feac7c98c5 (diff) | |
download | bcm5719-llvm-fca07890a9918e9814a7c3d6a39ea3a91789b546.tar.gz bcm5719-llvm-fca07890a9918e9814a7c3d6a39ea3a91789b546.zip |
[clang-format] Fix Bug 41407
Differential Revision: https://reviews.llvm.org/D60359
llvm-svn: 357851
-rw-r--r-- | clang/lib/Format/ContinuationIndenter.cpp | 2 | ||||
-rw-r--r-- | clang/unittests/Format/FormatTest.cpp | 7 |
2 files changed, 8 insertions, 1 deletions
diff --git a/clang/lib/Format/ContinuationIndenter.cpp b/clang/lib/Format/ContinuationIndenter.cpp index b64fdd7c0ba..577d96d52c5 100644 --- a/clang/lib/Format/ContinuationIndenter.cpp +++ b/clang/lib/Format/ContinuationIndenter.cpp @@ -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; diff --git a/clang/unittests/Format/FormatTest.cpp b/clang/unittests/Format/FormatTest.cpp index 110d60a5a86..dc2512a9e27 100644 --- a/clang/unittests/Format/FormatTest.cpp +++ b/clang/unittests/Format/FormatTest.cpp @@ -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) { |