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)
Mar 6 2024, 9:07 PM
Unknown Object (File)
Feb 18 2024, 3:00 AM
Unknown Object (File)
Jan 25 2024, 10:42 PM
Unknown Object (File)
Jan 19 2024, 10:59 AM
Unknown Object (File)
Jan 3 2024, 10:00 AM
Unknown Object (File)
Dec 23 2023, 12:13 AM
Unknown Object (File)
Dec 13 2023, 6:59 PM
Unknown Object (File)
Nov 26 2023, 11:55 AM
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.