Skip to content

Commit 3f6ae15

Browse files
author
git apple-llvm automerger
committed
Merge commit '228a893b03a9' from llvm.org/release/21.x into stable/21.x
2 parents 8e45ada + 228a893 commit 3f6ae15

File tree

2 files changed

+6
-1
lines changed

2 files changed

+6
-1
lines changed

clang/lib/Format/TokenAnnotator.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6271,7 +6271,8 @@ bool TokenAnnotator::canBreakBefore(const AnnotatedLine &Line,
62716271
}
62726272

62736273
if (Right.is(tok::colon) &&
6274-
!Right.isOneOf(TT_CtorInitializerColon, TT_InlineASMColon)) {
6274+
!Right.isOneOf(TT_CtorInitializerColon, TT_InlineASMColon,
6275+
TT_BitFieldColon)) {
62756276
return false;
62766277
}
62776278
if (Left.is(tok::colon) && Left.isOneOf(TT_DictLiteral, TT_ObjCMethodExpr)) {

clang/unittests/Format/FormatTest.cpp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4050,6 +4050,10 @@ TEST_F(FormatTest, FormatsBitfields) {
40504050
" uchar : 8;\n"
40514051
" uchar other;\n"
40524052
"};");
4053+
verifyFormat("struct foo {\n"
4054+
" uint8_t i_am_a_bit_field_this_long\n"
4055+
" : struct_with_constexpr::i_am_a_constexpr_lengthhhhh;\n"
4056+
"};");
40534057
FormatStyle Style = getLLVMStyle();
40544058
Style.BitFieldColonSpacing = FormatStyle::BFCS_None;
40554059
verifyFormat("struct Bitfields {\n"

0 commit comments

Comments
 (0)