summaryrefslogtreecommitdiffstats
path: root/clang/lib/Format/ContinuationIndenter.cpp
diff options
context:
space:
mode:
authorDaniel Jasper <djasper@google.com>2013-11-07 14:02:28 +0000
committerDaniel Jasper <djasper@google.com>2013-11-07 14:02:28 +0000
commit6b6e7c37eac2bd35a897ba8d161584e5511031a7 (patch)
treea34e389c1d4c617da10f8757b5b7ef92aa949fe8 /clang/lib/Format/ContinuationIndenter.cpp
parent29c3b55897fc3986201d2f06a728447a29a2520e (diff)
downloadbcm5719-llvm-6b6e7c37eac2bd35a897ba8d161584e5511031a7.tar.gz
bcm5719-llvm-6b6e7c37eac2bd35a897ba8d161584e5511031a7.zip
clang-format: Fix corner case for brace alignment.
Before: Constructor::Constructor() : some_value{ // aaaaaaa // } {} After: Constructor::Constructor() : some_value{ // aaaaaaa // } {} llvm-svn: 194204
Diffstat (limited to 'clang/lib/Format/ContinuationIndenter.cpp')
-rw-r--r--clang/lib/Format/ContinuationIndenter.cpp4
1 files changed, 3 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;
OpenPOWER on IntegriCloud