Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion clang/lib/Format/TokenAnnotator.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -6269,7 +6269,8 @@ bool TokenAnnotator::canBreakBefore(const AnnotatedLine &Line,
}

if (Right.is(tok::colon) &&
!Right.isOneOf(TT_CtorInitializerColon, TT_InlineASMColon)) {
!Right.isOneOf(TT_CtorInitializerColon, TT_InlineASMColon,
TT_BitFieldColon)) {
return false;
}
if (Left.is(tok::colon) && Left.isOneOf(TT_DictLiteral, TT_ObjCMethodExpr)) {
Expand Down
4 changes: 4 additions & 0 deletions clang/unittests/Format/FormatTest.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4050,6 +4050,10 @@ TEST_F(FormatTest, FormatsBitfields) {
" uchar : 8;\n"
" uchar other;\n"
"};");
verifyFormat("struct foo {\n"
" uint8_t i_am_a_bit_field_this_long\n"
" : struct_with_constexpr::i_am_a_constexpr_lengthhhhh;\n"
"};");
FormatStyle Style = getLLVMStyle();
Style.BitFieldColonSpacing = FormatStyle::BFCS_None;
verifyFormat("struct Bitfields {\n"
Expand Down