Open hel-ableton opened 2 years ago
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:
.clang-format
AlignAfterOpenBracket: AlwaysBreak BinPackParameters: false BinPackArguments: false ContinuationIndentWidth: 2 BreakBeforeBinaryOperators: NonAssignment
And here are three examples of what our code would currently look like:
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:
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
And here's a patch that would fix only the first example: 0001-Fix-Continuation-Indenter-2.patch.txt
The issue was most probably a by-product of this bugfix: https://github.com/llvm/llvm-project/commit/4636debc271f09f730697ab6873137a657c828f9
@llvm/issue-subscribers-clang-format
https://reviews.llvm.org/D136154
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:And here are three examples of what our code would currently look like:
Using clang-format 16.0.0, the formatting would change to this:
Here's a patch that would keep all three examples formatted as they are: 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
The issue was most probably a by-product of this bugfix: https://github.com/llvm/llvm-project/commit/4636debc271f09f730697ab6873137a657c828f9