diff options
| author | Daniel Jasper <djasper@google.com> | 2013-09-17 08:28:05 +0000 |
|---|---|---|
| committer | Daniel Jasper <djasper@google.com> | 2013-09-17 08:28:05 +0000 |
| commit | 88f9222c4e1ce739df01e94470e8d18770936683 (patch) | |
| tree | 1d6fd357199a5891641b28344999a5a187437d4c /clang/lib/Format | |
| parent | 0de8efa63dfaa099ecccfb7bd827f0f7ace827f8 (diff) | |
| download | bcm5719-llvm-88f9222c4e1ce739df01e94470e8d18770936683.tar.gz bcm5719-llvm-88f9222c4e1ce739df01e94470e8d18770936683.zip | |
clang-format: Fix line breaking bug after empty ifs.
Before:
if () {
}
else {
}
After:
if () {
} else {
}
This fixed llvm.org/PR17262.
llvm-svn: 190855
Diffstat (limited to 'clang/lib/Format')
| -rw-r--r-- | clang/lib/Format/TokenAnnotator.cpp | 1 |
1 files changed, 1 insertions, 0 deletions
diff --git a/clang/lib/Format/TokenAnnotator.cpp b/clang/lib/Format/TokenAnnotator.cpp index ee9172227b0..58a1eeb5a6d 100644 --- a/clang/lib/Format/TokenAnnotator.cpp +++ b/clang/lib/Format/TokenAnnotator.cpp @@ -1061,6 +1061,7 @@ void TokenAnnotator::calculateFormattingInformation(AnnotatedLine &Line) { Style.BreakConstructorInitializersBeforeComma) { Current->MustBreakBefore = true; } else if (Current->Previous->BlockKind == BK_Block && + Current->Previous->isNot(tok::r_brace) && Current->isNot(tok::r_brace)) { Current->MustBreakBefore = true; } else if (Current->is(tok::l_brace) && (Current->BlockKind == BK_Block)) { |

