Issue 55483
Summary [clang-format]: nested array of structures alignment
Labels new issue
Assignees
Reporter igagis
    # input

`.clang-format`:
```yaml
---
AlignArrayOfStructures: Right
ColumnLimit: '120'
ContinuationIndentWidth: '1'
IndentWidth: '1'
Language: Cpp
Standard: Latest
TabWidth: '1'
UseCRLF: 'false'
UseTab: ForContinuationAndIndentation

...
```

`main.cpp`:
```cpp
type expected = {
	{ 
		"1",
		{
			{"1", 1, 2},
			{"1", 11, 6}
		}
	},
	{
		"13",
		{
			{"13", 13, 0},
			{"13", 132, 3},
			{"13", 133, 5}
		}
	},
	{
		"14",
		{
			{"14", 14, 1}
		}
	},
	{
		"15",
		{
			{"15", 15, 4}
		}
	}
};
```

# result after formatting

```cpp
type expected = {
				{ "1",																					{{"1", 1, 2}, {"1", 11, 6}}},
				{"13", {{"13", 13, 0}, {"13", 132, 3}, {"13", 133, 5}}},
				{"14",																										{{"14", 14, 1}}},
				{"15",																										{{"15", 15, 4}}}
};
```
The formatted result makes no sense.

# proposal

Proposal is to format nested array of structures as in input file above.
I.e. if an array has another array as one of it's elements, then this array is formatted as one element per line.
_______________________________________________
llvm-bugs mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs

Reply via email to