[PATCH] D37513: [clang-format] Fix documentation for AllowAllParametersOfDeclarationOnNextLine

Lucja Mazur via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Wed Sep 6 05:24:21 PDT 2017


LuMa created this revision.

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.


https://reviews.llvm.org/D37513

Files:
  docs/ClangFormatStyleOptions.rst


Index: docs/ClangFormatStyleOptions.rst
===================================================================
--- docs/ClangFormatStyleOptions.rst
+++ docs/ClangFormatStyleOptions.rst
@@ -271,15 +271,29 @@
     int b = 2; // comment  b                int b = 2; // comment about b
 
 **AllowAllParametersOfDeclarationOnNextLine** (``bool``)
-  Allow putting all parameters of a function declaration onto
-  the next line even if ``BinPackParameters`` is ``false``.
+  If the function declaration doesn't fit on a line,
+  allow putting all parameters onto the next line 
+  even if ``BinPackParameters`` is ``false``.
+
+  This applies to declaration, whose parameters fit on a single line.
 
   .. code-block:: c++
 
-    true:                                   false:
-    myFunction(foo,                 vs.     myFunction(foo, bar, plop);
-               bar,
-               plop);
+    true:
+    int SomeFuncionWithVeryLooooooooongName(
+        int a, int b, int c, int d, int e, int f) {
+      return 0;
+    }
+
+    false:
+    int SomeFuncionWithVeryLooooooooongName(int a,
+                                            int b,
+                                            int c,
+                                            int d,
+                                            int e,
+                                            int f) {
+      return 0;
+    } 
 
 **AllowShortBlocksOnASingleLine** (``bool``)
   Allows contracting simple braced statements to a single line.


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D37513.113985.patch
Type: text/x-patch
Size: 1485 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20170906/5a4b453f/attachment-0001.bin>


More information about the cfe-commits mailing list