Current description of flag AllowAllParametersOfDeclarationOnNextLine in Clang-Format Style Options guide suggests that it is possible to format function declaration, which fits in a single line (what is not supported in current clang-format version). Also example is not reproducible and makes no sense.
I have added valid example and have stressed that flag applies only if declaration doesn't fit in a single line.
Details
Diff Detail
Event Timeline
Note that these changes need to be made to the corresponding comments in include/clang/Format/Format.h and then this file is auto-generated with docs/tools/dump_format_style.py.
docs/ClangFormatStyleOptions.rst | ||
---|---|---|
274 ↗ | (On Diff #113998) | Much better phrasing, thank you. |
278 ↗ | (On Diff #113998) | I think this sentence does not add value. |
283 ↗ | (On Diff #113998) | I think we should keep the example as short as it was previously (it is reproducible with a very short column limit), but you are right that the example was broken. So I suggest making this: void myFunction( int a, int b, int c); vs. void myFunction( int a, int b, int c); |
I moved changes to correct file.
When it comes to example, it doesn't seem to work with short function.
Example:
.clang-format:
ColumnLimit: 35 UseTab: Never BinPackParameters: false AllowAllParametersOfDeclarationOnNextLine: true
For input:
void myFunction(int a, int b, int c);
output is:
void myFunction(int a, int b, int c);
although it should be:
void myFunction( int a, int b, int c);
I don't know if it's bug or expected behavior. Maybe it's result of other flags or penalties. But i think an example should work for default values, so i suggest using the longer one.
Also run dump_format_style.py and keep the changed .rst file in this change.
Otherwise looks good.