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

2017-09-06 Thread Lucja Mazur via Phabricator via cfe-commits
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  bint 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 SomeFuncionWithVeryLongName(
+int a, int b, int c, int d, int e, int f) {
+  return 0;
+}
+
+false:
+int SomeFuncionWithVeryLongName(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.


Index: docs/ClangFormatStyleOptions.rst
===
--- docs/ClangFormatStyleOptions.rst
+++ docs/ClangFormatStyleOptions.rst
@@ -271,15 +271,29 @@
 int b = 2; // comment  bint 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 SomeFuncionWithVeryLongName(
+int a, int b, int c, int d, int e, int f) {
+  return 0;
+}
+
+false:
+int SomeFuncionWithVeryLongName(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.
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


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

2017-09-06 Thread Lucja Mazur via Phabricator via cfe-commits
LuMa updated this revision to Diff 113995.

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  bint 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 SomeFunctionWithVeryLongName(
+int a, int b, int c, int d, int e, int f) {
+  return 0;
+}
+
+false:
+int SomeFunctionWithVeryLongName(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.


Index: docs/ClangFormatStyleOptions.rst
===
--- docs/ClangFormatStyleOptions.rst
+++ docs/ClangFormatStyleOptions.rst
@@ -271,15 +271,29 @@
 int b = 2; // comment  bint 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 SomeFunctionWithVeryLongName(
+int a, int b, int c, int d, int e, int f) {
+  return 0;
+}
+
+false:
+int SomeFunctionWithVeryLongName(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.
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


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

2017-09-06 Thread Lucja Mazur via Phabricator via cfe-commits
LuMa updated this revision to Diff 113998.

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  bint 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 SomeFunctionWithVeryLongName(
+int a, int b, int c, int d, int e, int f) {
+  return 0;
+}
+
+false:
+int SomeFunctionWithVeryLongName(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.


Index: docs/ClangFormatStyleOptions.rst
===
--- docs/ClangFormatStyleOptions.rst
+++ docs/ClangFormatStyleOptions.rst
@@ -271,15 +271,29 @@
 int b = 2; // comment  bint 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 SomeFunctionWithVeryLongName(
+int a, int b, int c, int d, int e, int f) {
+  return 0;
+}
+
+false:
+int SomeFunctionWithVeryLongName(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.
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


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

2017-09-07 Thread Lucja Mazur via Phabricator via cfe-commits
LuMa updated this revision to Diff 114151.
LuMa added a comment.
Herald added a subscriber: klimek.

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.


https://reviews.llvm.org/D37513

Files:
  include/clang/Format/Format.h


Index: include/clang/Format/Format.h
===
--- include/clang/Format/Format.h
+++ include/clang/Format/Format.h
@@ -151,13 +151,20 @@
   /// \endcode
   bool AlignTrailingComments;
 
-  /// \brief Allow putting all parameters of a function declaration onto
+  /// \brief If the function declaration doesn't fit on a line,
+  /// allow putting all parameters of a function declaration onto
   /// the next line even if ``BinPackParameters`` is ``false``.
   /// \code
-  ///   true:   false:
-  ///   myFunction(foo, vs. myFunction(foo, bar, plop);
-  ///  bar,
-  ///  plop);
+  ///   true:
+  ///   void myFunction(
+  ///   int a, int b, int c, int d, int e);
+  ///   
+  ///   false:
+  ///   void myFunction(int a,
+  ///   int b,
+  ///   int c,
+  ///   int d,
+  ///   int e);
   /// \endcode
   bool AllowAllParametersOfDeclarationOnNextLine;
 


Index: include/clang/Format/Format.h
===
--- include/clang/Format/Format.h
+++ include/clang/Format/Format.h
@@ -151,13 +151,20 @@
   /// \endcode
   bool AlignTrailingComments;
 
-  /// \brief Allow putting all parameters of a function declaration onto
+  /// \brief If the function declaration doesn't fit on a line,
+  /// allow putting all parameters of a function declaration onto
   /// the next line even if ``BinPackParameters`` is ``false``.
   /// \code
-  ///   true:   false:
-  ///   myFunction(foo, vs. myFunction(foo, bar, plop);
-  ///  bar,
-  ///  plop);
+  ///   true:
+  ///   void myFunction(
+  ///   int a, int b, int c, int d, int e);
+  ///   
+  ///   false:
+  ///   void myFunction(int a,
+  ///   int b,
+  ///   int c,
+  ///   int d,
+  ///   int e);
   /// \endcode
   bool AllowAllParametersOfDeclarationOnNextLine;
 
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


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

2017-09-07 Thread Lucja Mazur via Phabricator via cfe-commits
LuMa updated this revision to Diff 114161.

https://reviews.llvm.org/D37513

Files:
  docs/ClangFormatStyleOptions.rst
  include/clang/Format/Format.h


Index: include/clang/Format/Format.h
===
--- include/clang/Format/Format.h
+++ include/clang/Format/Format.h
@@ -151,13 +151,20 @@
   /// \endcode
   bool AlignTrailingComments;
 
-  /// \brief Allow putting all parameters of a function declaration onto
+  /// \brief If the function declaration doesn't fit on a line,
+  /// allow putting all parameters of a function declaration onto
   /// the next line even if ``BinPackParameters`` is ``false``.
   /// \code
-  ///   true:   false:
-  ///   myFunction(foo, vs. myFunction(foo, bar, plop);
-  ///  bar,
-  ///  plop);
+  ///   true:
+  ///   void myFunction(
+  ///   int a, int b, int c, int d, int e);
+  ///   
+  ///   false:
+  ///   void myFunction(int a,
+  ///   int b,
+  ///   int c,
+  ///   int d,
+  ///   int e);
   /// \endcode
   bool AllowAllParametersOfDeclarationOnNextLine;
 
Index: docs/ClangFormatStyleOptions.rst
===
--- docs/ClangFormatStyleOptions.rst
+++ docs/ClangFormatStyleOptions.rst
@@ -271,15 +271,22 @@
 int b = 2; // comment  bint b = 2; // comment about b
 
 **AllowAllParametersOfDeclarationOnNextLine** (``bool``)
-  Allow putting all parameters of a function declaration onto
+  If the function declaration doesn't fit on a line,
+  allow putting all parameters of a function declaration onto
   the next line even if ``BinPackParameters`` is ``false``.
 
   .. code-block:: c++
 
-true:   false:
-myFunction(foo, vs. myFunction(foo, bar, plop);
-   bar,
-   plop);
+true:
+void myFunction(
+int a, int b, int c, int d, int e);
+
+false:
+void myFunction(int a,
+int b,
+int c,
+int d,
+int e);
 
 **AllowShortBlocksOnASingleLine** (``bool``)
   Allows contracting simple braced statements to a single line.


Index: include/clang/Format/Format.h
===
--- include/clang/Format/Format.h
+++ include/clang/Format/Format.h
@@ -151,13 +151,20 @@
   /// \endcode
   bool AlignTrailingComments;
 
-  /// \brief Allow putting all parameters of a function declaration onto
+  /// \brief If the function declaration doesn't fit on a line,
+  /// allow putting all parameters of a function declaration onto
   /// the next line even if ``BinPackParameters`` is ``false``.
   /// \code
-  ///   true:   false:
-  ///   myFunction(foo, vs. myFunction(foo, bar, plop);
-  ///  bar,
-  ///  plop);
+  ///   true:
+  ///   void myFunction(
+  ///   int a, int b, int c, int d, int e);
+  ///   
+  ///   false:
+  ///   void myFunction(int a,
+  ///   int b,
+  ///   int c,
+  ///   int d,
+  ///   int e);
   /// \endcode
   bool AllowAllParametersOfDeclarationOnNextLine;
 
Index: docs/ClangFormatStyleOptions.rst
===
--- docs/ClangFormatStyleOptions.rst
+++ docs/ClangFormatStyleOptions.rst
@@ -271,15 +271,22 @@
 int b = 2; // comment  bint b = 2; // comment about b
 
 **AllowAllParametersOfDeclarationOnNextLine** (``bool``)
-  Allow putting all parameters of a function declaration onto
+  If the function declaration doesn't fit on a line,
+  allow putting all parameters of a function declaration onto
   the next line even if ``BinPackParameters`` is ``false``.
 
   .. code-block:: c++
 
-true:   false:
-myFunction(foo, vs. myFunction(foo, bar, plop);
-   bar,
-   plop);
+true:
+void myFunction(
+int a, int b, int c, int d, int e);
+
+false:
+void myFunction(int a,
+int b,
+int c,
+int d,
+int e);
 
 **AllowShortBlocksOnASingleLine** (``bool``)
   Allows contracting simple braced statements to a single line.
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


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

2017-09-07 Thread Lucja Mazur via Phabricator via cfe-commits
LuMa added a comment.

I cannot commit the patch myself.


https://reviews.llvm.org/D37513



___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


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

2017-09-08 Thread Lucja Mazur via Phabricator via cfe-commits
LuMa closed this revision.
LuMa added a comment.

Thank you.


https://reviews.llvm.org/D37513



___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits