summaryrefslogtreecommitdiffstats
path: root/clang
diff options
context:
space:
mode:
Diffstat (limited to 'clang')
-rw-r--r--clang/lib/Format/ContinuationIndenter.cpp4
-rw-r--r--clang/unittests/Format/FormatTest.cpp5
2 files changed, 8 insertions, 1 deletions
diff --git a/clang/lib/Format/ContinuationIndenter.cpp b/clang/lib/Format/ContinuationIndenter.cpp
index 74cfbf0e901..d2da252a606 100644
--- a/clang/lib/Format/ContinuationIndenter.cpp
+++ b/clang/lib/Format/ContinuationIndenter.cpp
@@ -337,7 +337,9 @@ unsigned ContinuationIndenter::addTokenOnNewLine(LineState &State,
if (Current.is(tok::l_brace) && Current.BlockKind == BK_Block) {
State.Column = State.FirstIndent;
} else if (Current.isOneOf(tok::r_brace, tok::r_square)) {
- if (Current.closesBlockTypeList(Style))
+ if (Current.closesBlockTypeList(Style) ||
+ (Current.MatchingParen &&
+ Current.MatchingParen->BlockKind == BK_BracedInit))
State.Column = State.Stack[State.Stack.size() - 2].LastSpace;
else
State.Column = State.FirstIndent;
diff --git a/clang/unittests/Format/FormatTest.cpp b/clang/unittests/Format/FormatTest.cpp
index fc6ef2bb5ec..00c684cc401 100644
--- a/clang/unittests/Format/FormatTest.cpp
+++ b/clang/unittests/Format/FormatTest.cpp
@@ -4543,6 +4543,11 @@ TEST_F(FormatTest, LayoutCxx11ConstructorBraceInitializers) {
" T member = {arg1, arg2};\n"
"};",
NoSpaces);
+ verifyFormat("Constructor::Constructor()\n"
+ " : some_value{ //\n"
+ " aaaaaaa //\n"
+ " } {}",
+ NoSpaces);
}
TEST_F(FormatTest, FormatsBracedListsInColumnLayout) {
OpenPOWER on IntegriCloud