summaryrefslogtreecommitdiffstats
path: root/clang/lib
diff options
context:
space:
mode:
authorDaniel Jasper <djasper@google.com>2013-11-29 08:46:20 +0000
committerDaniel Jasper <djasper@google.com>2013-11-29 08:46:20 +0000
commite40caf9ad2e0566f8293fc704379db75edf08cf6 (patch)
tree14cfd26344379489ab93626211613bdeb791d9ac /clang/lib
parent1df3205e8c18af61cbb840ba8860d35c045d186e (diff)
downloadbcm5719-llvm-e40caf9ad2e0566f8293fc704379db75edf08cf6.tar.gz
bcm5719-llvm-e40caf9ad2e0566f8293fc704379db75edf08cf6.zip
clang-format: Fix bad indentation of nested blocks.
Before: DEBUG( // { f(); }); After: DEBUG( // { f(); }); Also add additional test to selected formatting of individual statements in nested blocks. llvm-svn: 195952
Diffstat (limited to 'clang/lib')
-rw-r--r--clang/lib/Format/ContinuationIndenter.cpp3
1 files changed, 2 insertions, 1 deletions
diff --git a/clang/lib/Format/ContinuationIndenter.cpp b/clang/lib/Format/ContinuationIndenter.cpp
index a8891fcc2f8..c2122ffb7d3 100644
--- a/clang/lib/Format/ContinuationIndenter.cpp
+++ b/clang/lib/Format/ContinuationIndenter.cpp
@@ -340,7 +340,8 @@ unsigned ContinuationIndenter::addTokenOnNewLine(LineState &State,
Penalty += Style.PenaltyBreakFirstLessLess;
if (Current.is(tok::l_brace) && Current.BlockKind == BK_Block) {
- State.Column = State.FirstIndent;
+ State.Column =
+ State.ParenLevel == 0 ? State.FirstIndent : State.Stack.back().Indent;
} else if (Current.isOneOf(tok::r_brace, tok::r_square)) {
if (Current.closesBlockTypeList(Style) ||
(Current.MatchingParen &&
OpenPOWER on IntegriCloud