[clang-format] AlignConsecutiveAssignments breaks at multiline trailing block comments
- Dominant language
- LLVM
- Stars
- 40.5k
- Forks
- 18.7k
- PR merge metrics
- PR metrics pending
Description
Input (expected stable):
```
struct M {
int d = 1; /* d */
int abcd = 2; /* abcd
test */
int e = 1;
};
```
Actual output (`int e` loses alignment):
```
struct M {
int d = 1; /* d */
int abcd = 2; /* abcd
test */
int e = 1;
};
```
.clang-format settings:
```
BasedOnStyle: LLVM
AlignConsecutiveAssignments: true
ColumnLimit: 0
```
The multiline trailing block comment breaks the consecutive assignment alignment sequence, so `int e` is not aligned with `int d` and `int abcd` above it.
Discovered while working on #208324.
Contributor guide
Research direction
Start with the clang-format reproducer and the shown AlignConsecutiveAssignments settings, then trace how a multiline trailing block comment affects the consecutive assignment sequence. Add a regression test covering the example and verify that the final assignment remains aligned with the preceding assignments.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- cpp
- Domain
- tooling
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Quiet
- Clarity
- Mostly clear
- Newbie friendliness
- 68/100