<table border="1" cellspacing="0" cellpadding="8">
<tr>
<th>Issue</th>
<td>
<a href=https://github.com/llvm/llvm-project/issues/58592>58592</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>
Changing results of the continuation indenter
</td>
</tr>
<tr>
<th>Labels</th>
<td>
new issue
</td>
</tr>
<tr>
<th>Assignees</th>
<td>
</td>
</tr>
<tr>
<th>Reporter</th>
<td>
hel-ableton
</td>
</tr>
</table>
<pre>
Our codebase is currently formatted using clang-format 6.0.0, so we urgently need to upgrade. Of course we would like to keep the diff as small as possible. Let's assume a minimum `.clang-format` file:
```
AlignAfterOpenBracket: AlwaysBreak
BinPackParameters: false
BinPackArguments: false
ContinuationIndentWidth: 2
BreakBeforeBinaryOperators: NonAssignment
```
And here are three examples of what our code would currently look like:
```c++
struct Derived {
Derived(
int firstArgWithLongName,
int secondArgWithLongName,
int thirdArgWithLongName,
int fourthArgWithLongName)
: Base(
firstArgWithLongName,
secondArgWithLongName,
thirdArgWithLongName,
fourthArgWithLongName) {}
};
{
return LongFunctionName(Arg1, ArgWithLongName2)
? SomeVeryLongFunctionCall(
Arg1,
Arg2,
NestedFunctionCallWithAveryLongName(
ArgToTheNestedFunctionCallWhichAlsoHasLongName))
: SomeOtherFunctionCall(Arg);
}
{
return VeryLongFunctionNameWithAVeryLongName(Arg1, Arg2)
|| FunctionName(
Arg1, Arg2, ArgWithLongName, ArgWithEvenLongerVeryLongName);
}
```
Using clang-format 16.0.0, the formatting would change to this:
```c++
struct Derived {
Derived(
int firstArgWithLongName,
int secondArgWithLongName,
int thirdArgWithLongName,
int fourthArgWithLongName)
: Base(
firstArgWithLongName, // <- changed indentation
secondArgWithLongName,
thirdArgWithLongName,
fourthArgWithLongName) {}
};
{
return LongFunctionName(Arg1, ArgWithLongName2) ? SomeVeryLongFunctionCall(
Arg1, // <- changed linebreaks...
Arg2,
NestedFunctionCallWithAveryLongName(
ArgToTheNestedFunctionCallWhichAlsoHasLongName))
: SomeOtherFunctionCall(Arg);
}
{
return VeryLongFunctionNameWithAVeryLongName(Arg1, Arg2)
|| FunctionName(
Arg1, Arg2, ArgWithLongName, ArgWithEvenLongerVeryLongName); // <- changed indentation
}
```
Here's a patch that would keep all three examples formatted as they are:
[0001-Fix-Continuation-Indenter-1.patch.txt](https://github.com/llvm/llvm-project/files/9859786/0001-Fix-Continuation-Indenter-1.patch.txt)
And here's a patch that would fix only the first example:
[0001-Fix-Continuation-Indenter-2.patch.txt](https://github.com/llvm/llvm-project/files/9859789/0001-Fix-Continuation-Indenter-2.patch.txt)
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJztV9tu2zgQ_Rr5hbAg0_FFD3qQnRpdoEgKbLd9pqWRxJoiDZKK47_fISXHl8h1UgQoFlhCliVyOJcz5OForfJ98thokqkc1swA4YZkjdYgrdiTQumaWQs5aQyXJckEk-Ww7SXTMAqjgC6JUWQHpNFlO0kCyltFmm2pWQ4heSxQfaNROYrtVCNyIvgGnMwGYEtsBSTnRUGYIaZmQriHrTKGrwVO_wI2oDODnaapgTBSc8nrpibBNApPPcJ3UnABwTgNovsgOtynUXf511TwUqaFBf24BbnQLNuggXFKUrFje7PQwDat5ILLrzj6lWlWA8obJ1UwYeBsPNUl-iXt5fBSSctlwyxX8i-Zo8QPntvKSdFOgbO1APQeUBfTe_RIM6taSw9KpohBKZ3y3lC6gGROKtCIDP5spQEIPLN6K8AQVZBdhblSXYo7-I8ZFkptfDaugZYFdOEu32usbjJL7kHzJ0xyMOv6yaEroPNDDyFcWsyHNhYR-sFt9UXJ8gGhxDVzLmQgUzK_JWUrrm8KFRiprV5JxUcpQhy4C1zrZ8627aa7bbvtcNtuutxZveK0B3h232UEH8aLsxwd4ddgGy2Jm7tqZOaWXKtjjlpHbpNeaKcXmHTArMjfqobvoPenqpa4J3vA8q3Tf22MXht7AIO8cmrBuZc-daY773unesXf1LcKepRUPKtSYdRnZk7T3xtt6qN9RP7RF6GiATflBe-XJFwB_hIxZ9bH8_08npNs9GQgmC3xIh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