[PATCH] D63062: Added New Style Rule: BitFieldDeclsOnSeparateLines
Manikishan Ghantasala via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Sun Jun 9 12:21:10 PDT 2019
Manikishan created this revision.
Manikishan added reviewers: aaron.ballman, rsmith.
Herald added a subscriber: krytarowski.
Herald added a project: clang.
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
BitFieldDeclsOnSeparateLines: 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, /* Bitfield; line up entries if desire*/
fuz : 5, /*jgifjjggirrj*/
zap : 2;
Repository:
rC Clang
https://reviews.llvm.org/D63062
Files:
docs/ClangFormatStyleOptions.rst
include/clang/Format/Format.h
lib/Format/ContinuationIndenter.cpp
lib/Format/Format.cpp
lib/Format/TokenAnnotator.cpp
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D63062.203749.patch
Type: text/x-patch
Size: 4740 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20190609/1017fb42/attachment.bin>
More information about the cfe-commits
mailing list