summaryrefslogtreecommitdiffstats
path: root/clang/lib/Format
diff options
context:
space:
mode:
authorDaniel Jasper <djasper@google.com>2015-04-29 08:29:26 +0000
committerDaniel Jasper <djasper@google.com>2015-04-29 08:29:26 +0000
commiteb45cb7cf9c56ea1c993dfcc59d9bf28057199e3 (patch)
tree61bba500ee44cb28b1c4b6357aa7172453d9a99a /clang/lib/Format
parentfda237d09fbe88371e1255acef92fe451201bedc (diff)
downloadbcm5719-llvm-eb45cb7cf9c56ea1c993dfcc59d9bf28057199e3.tar.gz
bcm5719-llvm-eb45cb7cf9c56ea1c993dfcc59d9bf28057199e3.zip
clang-format: Fix selective indentaiton in nested blocks.
Buggy case: someFunction( [] { // comment int i; // invoke formatting here. }, // force line break aaa); llvm-svn: 236091
Diffstat (limited to 'clang/lib/Format')
-rw-r--r--clang/lib/Format/UnwrappedLineFormatter.cpp4
1 files changed, 3 insertions, 1 deletions
diff --git a/clang/lib/Format/UnwrappedLineFormatter.cpp b/clang/lib/Format/UnwrappedLineFormatter.cpp
index f5120b9f2f3..dd65230cc40 100644
--- a/clang/lib/Format/UnwrappedLineFormatter.cpp
+++ b/clang/lib/Format/UnwrappedLineFormatter.cpp
@@ -461,7 +461,9 @@ UnwrappedLineFormatter::format(const SmallVectorImpl<AnnotatedLine *> &Lines,
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);
OpenPOWER on IntegriCloud