<table border="1" cellspacing="0" cellpadding="8">
<tr>
<th>Issue</th>
<td>
<a href=https://github.com/llvm/llvm-project/issues/62549>62549</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>
New Clang-Format style option: PackInheritanceList
</td>
</tr>
<tr>
<th>Labels</th>
<td>
new issue
</td>
</tr>
<tr>
<th>Assignees</th>
<td>
</td>
</tr>
<tr>
<th>Reporter</th>
<td>
Stadly
</td>
</tr>
</table>
<pre>
`Clang-Format` seems to be missing a style option for packing inheritance lists. I think we should have a `PackInheritanceList` behaving exactly like `PackConstructorInitializers` but for inheritance lists.
Suggested new option:
**PackInheritanceList** (`PackInheritanceListStyle`)
The pack inheritance list style to use.
Possible values:
- `PILS_Never` (in configuration: `Never`) Always put each inherited class/struct on its own line.
```
class A
: B,
C
{}
```
- `PILS_BinPack` (in configuration: `BinPack`) Bin-pack inherited classes/structs.
```
class A
: Aaaaaaaaaaaaaaaaaaaa, Bbbbbbbbbbbbbbbbbbbb,
Cccccccccccccccccccc
{}
```
- `PILS_CurrentLine` (in configuration: `CurrentLine`) Put all inherited classes/structs on the current line if they fit. Otherwise, put each one on its own line.
```
class A : B, C
{}
class A
: Aaaaaaaaaaaaaaaaaaaa,
Bbbbbbbbbbbbbbbbbbbb,
Ddddddddddddd
{}
```
- `PCIL_NextLine` (in configuration: `NextLine`) Same as `PCIS_CurrentLine` except that if all inherited classes/structs do not fit on the current line, try to fit them on the next line.
```
class A : B, C
{}
class A
: Aaaaaaaaaaaaaaaaaaaa, Bbbbbbbbbbbbbbbbbbbb, Ddddddddddddd
{}
class A
: Aaaaaaaaaaaaaaaaaaaa,
Bbbbbbbbbbbbbbbbbbbb,
Cccccccccccccccccccc
{}
```
- `PILS_NextLineOnly` (in configuration: `NextLineOnly`) Put all inherited classes/structs on the next line if they fit. Otherwise, put each one on its own line.
```
class A
: B, C
{}
class A
: Aaaaaaaaaaaaaaaaaaaa, Bbbbbbbbbbbbbbbbbbbb, Ddddddddddddd
{}
class A
: Aaaaaaaaaaaaaaaaaaaa,
Bbbbbbbbbbbbbbbbbbbb,
Cccccccccccccccccccc
{}
```
Inheritance lists and constructor initializers go hand in hand. With the proposed new style option, we have symmetry with the following options:
`BreakConstructorInitializers` <=> `BreakInheritanceList`
`PackConstructorInitializers` <=> `PackInheritanceList`
And then we have `ConstructorInitializerIndentWidth` that affect both inheritance lists and constructor initializers.
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJzsVt9vozgQ_mucl1EjYhIKDzw0yUWKVHUr5aR9XBkYwFdjR_aQNPfXn0zIjza5dCPd3tNaCASeGc9839h8wjlZacSUTaZsMh-Ilmpj0xWJQu0GmSl2KYuCmRK6elgY2whiUQAOsXFABjKERjondQUCHO0UglmTNBpKY2Et8jc_JXWNVpLQOYKSjtwQlkC11G-wRXC1aVUBtdggCGBR8Cryt-XJ5Vm6btEMa7Hx4fBd5KR2oOQbHuxnRjuybU7GLrUkKZT8G63r_FrqsrnMggVzFjzt76u2qtARFqBx2xfBwn6ScX9dy6ubAMbj63mvPCQsChhP9pH-rLGD5SKbHj0y0Dr8kNmrcU5mCmEjVIvulFR3f-gQWD6vfrzgBq0vmPFYasiNLmXVWtFX4u0OJown8KS2Yudg3RKgyOtDQlhAroRzjC_2gILRIMmB2WpQUh9zi4L-6l47H-hzAgDwK04Zn52-APQv7HHKHudXw3yuaSq1R_V2VScjX9dU6odzhA8F4akkd0cNT-JyMD6DaXY5PpebX467EZi11qKmZ6nxNgofDT0Sry2BUOoWEJ5cqhHyvXNHMMjSf9tBKWkI36hGu5UOfdHHZjEa7-qLYztc7YG70T9H-TYR8-Js3AX-bPn84wXffwL5MysP-0o0CML1QS4YxPcc1wRUC_JIf0VQYUAb8lxc48ojSnbnjw1vQTU2BzON7_S_E_NvbHzJwy9sgf9kGx44_qbV7ue6obe8cyMeWfsVu_DydP7N-hXWl5-FAghdeK4PCgPkmcSAykDtDaTunkP4LqnuyFxbszaulxTn6shjs8W95HG7pkG_h7cHt9IoZbZe6e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