clang-format: Fix selective indentaiton in nested blocks.
Buggy case:
someFunction(
[] {
// comment
int i; // invoke formatting here.
}, // force line break
aaa);
llvm-svn: 236091
diff --git a/clang/lib/Format/UnwrappedLineFormatter.cpp b/clang/lib/Format/UnwrappedLineFormatter.cpp
index f5120b9..dd65230 100644
--- a/clang/lib/Format/UnwrappedLineFormatter.cpp
+++ b/clang/lib/Format/UnwrappedLineFormatter.cpp
@@ -461,7 +461,9 @@
if (static_cast<int>(LevelIndent) - Offset >= 0)
LevelIndent -= Offset;
- if (Tok->isNot(tok::comment) && !TheLine.InPPDirective)
+ if ((Tok->isNot(tok::comment) ||
+ IndentForLevel[TheLine.Level] == -1) &&
+ !TheLine.InPPDirective)
IndentForLevel[TheLine.Level] = LevelIndent;
} else if (!DryRun) {
Whitespaces->addUntouchableToken(*Tok, TheLine.InPPDirective);