| Issue |
76663
|
| Summary |
[clang-format] Add an option to specify where align declaration and assignment should apply
|
| Labels |
|
| Assignees |
|
| Reporter |
davidavetyan
|
**AlignConsecutiveDeclarations** and **AlignConsecutiveAssignments** options in clang-format apply on all variables in the code, making it impossible to have different settings for class members / enums / other variable definitions.
For example:
```
struct A
{
// Class/struct member declarations to be aligned
int m_a;
double m_b;
long m_c;
};
int f()
{
// Other variable declarations shouldn't be aligned
int firstVar;
double secondVar;
}
```
Same distinction should be available for assignment as well:
```
// Align assignments in enum value definitions, but nowhere else.
enum WindowState {
WindowNoState = 0x00000000,
WindowMinimized = 0x00000001,
WindowMaximized = 0x00000002,
WindowFullScreen = 0x00000004,
WindowActive = 0x00000008
};
```
The option could look something like this:
```
AlignDeclarationsOptions:
ClassMemberVariables: true
Other: false
AlignAssignmentsOptions:
ClassMemberVariables: false
EnumValues: true
Other: false
```
_______________________________________________
llvm-bugs mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs