| Issue |
55488
|
| Summary |
[clang-format]: treat double {{}} as single {} in array initialization
|
| Labels |
new issue
|
| Assignees |
|
| Reporter |
igagis
|
# input
`.clang-format`:
```yaml
---
AlignAfterOpenBracket: BlockIndent
AlignArrayOfStructures: Right
BinPackArguments: 'false'
ColumnLimit: '120'
ContinuationIndentWidth: '1'
IndentWidth: '1'
Language: Cpp
Standard: Latest
TabWidth: '1'
UseCRLF: 'false'
UseTab: ForContinuationAndIndentation
...
```
`main.cpp`:
```cpp
std::array<str_num_pair, 5> arr = {{
{"hello"sv, 13},
{ "bye"sv, 15},
{ "how"sv, 33},
{ "are"sv, 4},
{ "you"sv, 9}
}};
```
# after formatting
```cpp
std::array<str_num_pair, 5> arr = {
{{"hello"sv, 13}, {"bye"sv, 15}, {"how"sv, 33}, {"are"sv, 4}, {"you"sv, 9}}
};
```
# proposal
when double curly brackets `{{...}}` appear in initializer, treat them as single ones `{ ... }`, i.e. the original code snippet formatting should not change.
_______________________________________________
llvm-bugs mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs