Clang-format: add finer-grained options for putting all arguments on one line
Summary:
Add two new options,
AllowAllArgumentsOnNextLine and
AllowAllConstructorInitializersOnNextLine. These mirror the existing
AllowAllParametersOfDeclarationOnNextLine and allow me to support an
internal style guide where I work. I think this would be generally
useful, some have asked for it on stackoverflow:
https://stackoverflow.com/questions/30057534/clang-format-binpackarguments-not-working-as-expected
https://stackoverflow.com/questions/38635106/clang-format-how-to-prevent-all-function-arguments-on-next-line
Reviewers: djasper, krasimir, MyDeveloperDay
Reviewed By: MyDeveloperDay
Subscribers: jkorous, MyDeveloperDay, aol-nnov, lebedev.ri, uohcsemaj, cfe-commits, klimek
Differential Revision: https://reviews.llvm.org/D40988
Patch By: russellmcc (Russell McClellan)
llvm-svn: 356834
diff --git a/clang/docs/ClangFormatStyleOptions.rst b/clang/docs/ClangFormatStyleOptions.rst
index 1a783fd..0ddc313 100644
--- a/clang/docs/ClangFormatStyleOptions.rst
+++ b/clang/docs/ClangFormatStyleOptions.rst
@@ -277,6 +277,41 @@
int a; // My comment a vs. int a; // My comment a
int b = 2; // comment b int b = 2; // comment about b
+**AllowAllArgumentsOnNextLine** (``bool``)
+ If a function call or braced initializer list doesn't fit on a
+ line, allow putting all arguments onto the next line, even if
+ ``BinPackArguments`` is ``false``.
+
+ .. code-block:: c++
+
+ true:
+ callFunction(
+ a, b, c, d);
+
+ false:
+ callFunction(a,
+ b,
+ c,
+ d);
+
+**AllowAllConstructorInitializersOnNextLine** (``bool``)
+ If a constructor definition with a member initializer list doesn't
+ fit on a single line, allow putting all member initializers onto the next
+ line, if ```ConstructorInitializerAllOnOneLineOrOnePerLine``` is true.
+ Note that this parameter has no effect if
+ ```ConstructorInitializerAllOnOneLineOrOnePerLine``` is false.
+
+ .. code-block:: c++
+
+ true:
+ MyClass::MyClass() :
+ member0(0), member1(2) {}
+
+ false:
+ MyClass::MyClass() :
+ member0(0),
+ member1(2) {}
+
**AllowAllParametersOfDeclarationOnNextLine** (``bool``)
If the function declaration doesn't fit on a line,
allow putting all parameters of a function declaration onto