This new Style rule is made as a part of adding support for NetBSD KNF in clang-format. This style Lines up BitField Declarations on consecutive lines with correct Indentation. The working of this Style rule shown below:
//Configuration
BitFieldDeclarationsOnePerLine: true
//Before Formatting:
unsigned int bas :3, hh : 4, jjj : 8; unsigned int baz:1, fuz:5, zap:2;
//After Formatting:
unsigned int bas : 3, hh : 4, jjj : 8; unsigned int baz : 1, fuz : 5, zap : 2;
This style is formatted even if the one-line declaration line is less than the column limit.
There is a minor Bug:
Comments after the bitfield in before the break line will not cause a proper indentation.
//Before Formatting:
unsigned int baz:1, /* foo*/ fuz:5, /*bar*/ zap:2;
//After Formatting:
unsigned int baz : 1, /* foo*/ fuz : 5, /*bar*/ zap : 2;
Isn't the documentation normally alphabetric? shouldn't it be after AlignConsecutiveAssignments