Issue 178164
Summary clang-format: `UseTab` interfering with `AlignConsecutiveAssignments`
Labels clang-format
Assignees
Reporter thepigeongenerator
    To reproduce: (in clang-format version 21.1.6)
```yaml
UseTab: ForContinuationAndIndentation
AlignConsecutiveAssignments: Consecutive
TabWidth: 8
IndentWidth: 8
ContinuationIndentWidth: 8
```

Which produces the following formatting (visualised):
```c
int main(void)⋅{
»       long⋅nmem,⋅size;
»       struct⋅dynarr⋅arr;

»       long⋅len⋅=⋅nmem⋅*⋅size;
»       arr⋅⋅⋅⋅⋅⋅=⋅{
⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅nmem,
⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅malloc(len),
⋅⋅⋅⋅⋅⋅⋅⋅};
}
```
One part of the problem, seems from the looks of it, is that it (correctly) aligns the `=` symbol, but then fails to "switch back" to tabulations afterwards for some reason.

Beyond that, I have tested using `UseTab=Always` instead, here it seems the issue has magnified, since now it breaks alignment entirely:
```c
int⋅main(void)⋅{
»       long⋅nmem,⋅size;
»       struct⋅dynarr⋅arr;

»       long⋅len⋅=⋅nmem⋅*⋅size;
»       arr»       ⋅=⋅{
»       »       ⋅⋅⋅⋅⋅nmem,
»       »       ⋅⋅⋅⋅⋅malloc(len),
»       ⋅⋅⋅⋅⋅};
}
```
Where it seems to be appending 5 spaces for reasons unknown to me.
_______________________________________________
llvm-bugs mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs

Reply via email to