Issue 142050
Summary [clang-format] Bit field with constant width specifier aligment
Labels clang-format
Assignees
Reporter EugeneZelenko
    Bit field-related options does not work for widths declared as constants/macros.

Test file:

```
#define FIELD1_WIDTH 1

class Test
{
public:
    constexpr static unsigned FIELD3_WIDTH = 2;

private:
    unsigned field1_ : FIELD1_WIDTH;
    unsigned field2_ : 10;
    unsigned field3_ : FIELD3_WIDTH;
    unsigned field4_ : 3;
};
```

I tried 19.1.1 and `main` (49d48c32e04742ebd05cbbd7dd544b1217b6d9d0)

Configuration:

```
BasedOnStyle: LLVM

BreakBeforeBraces: Allman
ColumnLimit: 100
IndentPPDirectives: AfterHash
IndentWidth: 4
LineEnding: LF
UseTab: Never

Language: Cpp
AccessModifierOffset: -4
AlignAfterOpenBracket: AlwaysBreak
AlignConsecutiveAssignments: AcrossComments
AlignConsecutiveBitFields:
  Enabled: true
 AcrossEmptyLines: true
  AcrossComments: true
AlignConsecutiveDeclarations:
  Enabled: true
  AcrossEmptyLines: false
  AcrossComments: false
AlignConsecutiveMacros: AcrossEmptyLines
AlignConsecutiveShortCaseStatements:
  Enabled: true
 AcrossEmptyLines: true
  AcrossComments: true
  AlignCaseColons: false
AlignEscapedNewlines: LeftWithLastLine
AlignOperands: Align
AllowAllArgumentsOnNextLine: false
AllowAllParametersOfDeclarationOnNextLine: false
AllowShortBlocksOnASingleLine: false
AllowShortCaseExpressionOnASingleLine: false
AllowShortCaseLabelsOnASingleLine: false
AllowShortCompoundRequirementOnASingleLine: false
AllowShortEnumsOnASingleLine: false
AllowShortFunctionsOnASingleLine: Inline
AllowShortIfStatementsOnASingleLine: Never
AllowShortLambdasOnASingleLine: All
AllowShortLoopsOnASingleLine: false
BitFieldColonSpacing: After
BinPackArguments: false
BinPackParameters: false
BreakBeforeBinaryOperators: NonAssignment
BreakBeforeTernaryOperators: true
BreakConstructorInitializers: BeforeComma
BreakTemplateDeclarations: Yes
ConstructorInitializerIndentWidth: 0
ContinuationIndentWidth: 4
EmptyLineAfterAccessModifier: Never
EmptyLineBeforeAccessModifier: Always
FixNamespaceComments: true
MaxEmptyLinesToKeep: 1
PackConstructorInitializers: Never
PenaltyReturnTypeOnItsOwnLine: 1000
PointerAlignment: Left
SortUsingDeclarations: true
StatementMacros:
 - PyObject_HEAD
  - Q_OBJECT
```
_______________________________________________
llvm-bugs mailing list
llvm-bugs@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs

Reply via email to