Issue 148096
Summary clang-format AlignArrayOfStructures has bad behavior on None
Labels clang-format
Assignees
Reporter EthanRutherford
    `AlignArrayOfStructures: None` behaves bizarrely, doing more "alignment" IMO than Left or Right does.

None:
```
const std::vector<Vertex> vertices = { { { -0.5f, -0.5f }, { 1.0f, 0.0f, 0.0f } },
                                     { { 0.5f, -0.5f }, { 0.0f, 1.0f, 0.0f } },
                                     { { 0.5f, 0.5f }, { 0.0f, 0.0f, 1.0f } },
                                     { { -0.5f, 0.5f }, { 1.0f, 1.0f, 1.0f } } };
```

Left:
```
const std::vector<Vertex> vertices = {
    { { -0.5f, -0.5f }, { 1.0f, 0.0f, 0.0f } },
    { { 0.5f, -0.5f },  { 0.0f, 1.0f, 0.0f } },
    { { 0.5f, 0.5f }, { 0.0f, 0.0f, 1.0f } },
    { { -0.5f, 0.5f },  { 1.0f, 1.0f, 1.0f } }
};
```

Expected behavior (but not possible with current clang-format, as far as I can tell):
```
const std::vector<Vertex> vertices = {
    { { -0.5f, -0.5f }, { 1.0f, 0.0f, 0.0f } },
    { { 0.5f, -0.5f }, { 0.0f, 1.0f, 0.0f } },
    { { 0.5f, 0.5f }, { 0.0f, 0.0f, 1.0f } },
    { { -0.5f, 0.5f }, { 1.0f, 1.0f, 1.0f } }
};
```

Additionally, in my actual setup where I use tabs, the alignment is totally broken.
For some reason it tries to use a mix of tabs and spaces to do the alignment, and gets it completely wrong. Not sure what it's expecting this tab to align with, but `tabSize` is set to 4 in my config.

<img width="1005" height="306" alt="Image" src="" />

So, all three possible options for this setting are producing undesireable results.
_______________________________________________
llvm-bugs mailing list
llvm-bugs@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs

Reply via email to