clang-format: Fix incorrect enum parsing / layouting.
Before:
enum {
Bar = Foo < int,
int > ::value
};
After:
enum {
Bar = Foo<int, int>::value
};
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@190674 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/lib/Format/TokenAnnotator.cpp b/lib/Format/TokenAnnotator.cpp
index dec631f..db17135 100644
--- a/lib/Format/TokenAnnotator.cpp
+++ b/lib/Format/TokenAnnotator.cpp
@@ -1057,6 +1057,12 @@
} else if (Current->Type == TT_CtorInitializerComma &&
Style.BreakConstructorInitializersBeforeComma) {
Current->MustBreakBefore = true;
+ } else if (Current->Previous->BlockKind == BK_Block &&
+ Current->isNot(tok::r_brace)) {
+ Current->MustBreakBefore = true;
+ } else if (Current->is(tok::l_brace) && (Current->BlockKind == BK_Block)) {
+ Current->MustBreakBefore =
+ Style.BreakBeforeBraces == FormatStyle::BS_Allman;
}
Current->CanBreakBefore =
Current->MustBreakBefore || canBreakBefore(Line, *Current);