diff options
author | Daniel Jasper <djasper@google.com> | 2013-10-30 14:04:10 +0000 |
---|---|---|
committer | Daniel Jasper <djasper@google.com> | 2013-10-30 14:04:10 +0000 |
commit | 16fc75421688428ce6c84cccdaba87c694484045 (patch) | |
tree | 76c1c93e89ab5444b218a41cc2fc417344c49a62 /clang/lib/Format/ContinuationIndenter.cpp | |
parent | 9885784d67d7154eb5861130cc2b4b29e4cbf9ea (diff) | |
download | bcm5719-llvm-16fc75421688428ce6c84cccdaba87c694484045.tar.gz bcm5719-llvm-16fc75421688428ce6c84cccdaba87c694484045.zip |
clang-format: Fix indenting corner case with comment and else.
Before:
if (a) {
f();
}
// or else ..
else {
g();
}
After:
if (a) {
f();
}
// or else ..
else {
g();
}
llvm-svn: 193684
Diffstat (limited to 'clang/lib/Format/ContinuationIndenter.cpp')
-rw-r--r-- | clang/lib/Format/ContinuationIndenter.cpp | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/clang/lib/Format/ContinuationIndenter.cpp b/clang/lib/Format/ContinuationIndenter.cpp index c1f448be56b..74cfbf0e901 100644 --- a/clang/lib/Format/ContinuationIndenter.cpp +++ b/clang/lib/Format/ContinuationIndenter.cpp @@ -391,7 +391,8 @@ unsigned ContinuationIndenter::addTokenOnNewLine(LineState &State, State.Column = State.Stack.back().Indent; // Ensure that we fall back to the continuation indent width instead of just // flushing continuations left. - if (State.Column == State.FirstIndent) + if (State.Column == State.FirstIndent && + PreviousNonComment->isNot(tok::r_brace)) State.Column += Style.ContinuationIndentWidth; } |