[PATCH] D125171: Add a new clang-format option AlwaysBreakBeforeFunctionParameters

jonathan molinatto via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Wed Mar 15 10:31:27 PDT 2023


jrmolin added a comment.

In D125171#4195298 <https://reviews.llvm.org/D125171#4195298>, @owenpan wrote:

> In D125171#4193996 <https://reviews.llvm.org/D125171#4193996>, @jrmolin wrote:
>
>> In D125171#4167866 <https://reviews.llvm.org/D125171#4167866>, @owenpan wrote:
>>
>>> Please see https://clang.llvm.org/docs/ClangFormatStyleOptions.html#adding-additional-style-options.
>>
>> I am doing this for my team, which writes the security endpoint for Elastic Defend. The code is currently private, though the binaries are free to download and run. The number of contributors is around 30, and the lines of code is in the 100Ks (around 500K). I have not found a way to accomplish what this does with the available options. I am adding tests and am happy to maintain this. It is a rather small addition, so it is quite simple to keep updated.
>
> Do you "have a publicly accessible style guide"?

Unfortunately, we don't. I can create one in the likeness of the others, but I'm not sure where it will get published. I will talk to my managers about publishing a style doc.



================
Comment at: clang/docs/ClangFormatStyleOptions.rst:1372
+.. _AlwaysBreakBeforeFunctionParameters:
+
+**AlwaysBreakBeforeFunctionParameters** (``Boolean``) :versionbadge:`clang-format 16.0`
----------------
MyDeveloperDay wrote:
> Regererate
How do I re-generate? I'm happy to! I just don't see where to do that.


================
Comment at: clang/lib/Format/Format.cpp:872
     IO.mapOptional("AlwaysBreakBeforeMultilineStrings",
                    Style.AlwaysBreakBeforeMultilineStrings);
+    IO.mapOptional("AlwaysBreakBeforeFunctionParameters",
----------------
MyDeveloperDay wrote:
> Needs a parse test
I will add one. Thanks for the reminder!


================
Comment at: clang/unittests/Format/FormatTest.cpp:25357
+  // verify that there is no break by default
+  verifyFormat("int function1(int param1, int param2, int param3);\n"
+               "int function2();\n",
----------------
MyDeveloperDay wrote:
> Please write it out long form
What do you mean by "long form"?


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D125171/new/

https://reviews.llvm.org/D125171



More information about the cfe-commits mailing list