Page MenuHomeFreeBSD

clang-format: Avoid breaking after the opening paren of function definitions
ClosedPublic

Authored by arichardson on Oct 27 2020, 4:39 PM.
Tags
None
Referenced Files
Unknown Object (File)
Sat, Jan 18, 7:37 PM
Unknown Object (File)
Sat, Jan 18, 7:37 PM
Unknown Object (File)
Sat, Jan 18, 7:37 PM
Unknown Object (File)
Sat, Jan 18, 7:24 PM
Unknown Object (File)
Mon, Jan 13, 4:51 PM
Unknown Object (File)
Dec 21 2024, 1:20 AM
Unknown Object (File)
Dec 12 2024, 7:24 PM
Unknown Object (File)
Dec 3 2024, 9:50 PM
Subscribers

Details

Summary

This depends on https://reviews.llvm.org/D90246, but once that has landed
clang-format will no longer format code like this:

int
myfunction(
    int param1, int param2, int param2)
{
   ...
}

and instead create the following:

int
myfunction(int param1, int param2,
    int param2)
{
   ...
}

Diff Detail

Repository
rS FreeBSD src repository - subversion
Lint
Lint Not Applicable
Unit
Tests Not Applicable

Event Timeline

arichardson created this revision.

LGTM. You could go ahead and commit the changes that work with current clang-format separately, if you're waiting on upstream for the AllowAllArgumentsOnNextLine.

Do you know if there is a mechanism to get the type and qualifiers on an independent line before the function name? That jumps out as a missing piece in both examples. Thanks!

This revision is now accepted and ready to land.Oct 27 2020, 4:56 PM
In D26978#601758, @cem wrote:

LGTM. You could go ahead and commit the changes that work with current clang-format separately, if you're waiting on upstream for the AllowAllArgumentsOnNextLine.

Do you know if there is a mechanism to get the type and qualifiers on an independent line before the function name? That jumps out as a missing piece in both examples. Thanks!

That was a bug in my commit description, AlwaysBreakAfterReturnType: TopLevelDefinitions will ensure that the return type is on a separate line.