sylvestre.ledru created this revision.
sylvestre.ledru added a reviewer: krasimir.

reported here https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=911561

clang-format-7 -style="{BreakBeforeBraces: Stroustrup}" wasn't doing
the same as the doc


Repository:
  rC Clang

https://reviews.llvm.org/D53520

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
@@ -528,25 +528,21 @@
     ///   enum X : int { A, B };
     /// \endcode
     BS_Mozilla,
-    /// Like ``Attach``, but break before function definitions, ``catch``, and
-    /// ``else``.
+    /// Always break before braces.
     /// \code
     ///   try {
     ///     foo();
-    ///   } catch () {
+    ///   }
+    ///   catch () {
     ///   }
     ///   void foo() { bar(); }
-    ///   class foo
-    ///   {
+    ///   class foo {
     ///   };
     ///   if (foo()) {
-    ///   } else {
     ///   }
-    ///   enum X : int
-    ///   {
-    ///     A,
-    ///     B
-    ///   };
+    ///   else {
+    ///   }
+    ///   enum X : int { A, B };
     /// \endcode
     BS_Stroustrup,
     /// Always break before braces.
Index: docs/ClangFormatStyleOptions.rst
===================================================================
--- docs/ClangFormatStyleOptions.rst
+++ docs/ClangFormatStyleOptions.rst
@@ -901,27 +901,23 @@
       enum X : int { A, B };
 
   * ``BS_Stroustrup`` (in configuration: ``Stroustrup``)
-    Like ``Attach``, but break before function definitions, ``catch``, and
-    ``else``.
+    Always break before braces.
 
     .. code-block:: c++
 
       try {
         foo();
-      } catch () {
+      }
+      catch () {
       }
       void foo() { bar(); }
-      class foo
-      {
+      class foo {
       };
       if (foo()) {
-      } else {
       }
-      enum X : int
-      {
-        A,
-        B
-      };
+      else {
+      }
+      enum X : int { A, B };
 
   * ``BS_Allman`` (in configuration: ``Allman``)
     Always break before braces.


Index: include/clang/Format/Format.h
===================================================================
--- include/clang/Format/Format.h
+++ include/clang/Format/Format.h
@@ -528,25 +528,21 @@
     ///   enum X : int { A, B };
     /// \endcode
     BS_Mozilla,
-    /// Like ``Attach``, but break before function definitions, ``catch``, and
-    /// ``else``.
+    /// Always break before braces.
     /// \code
     ///   try {
     ///     foo();
-    ///   } catch () {
+    ///   }
+    ///   catch () {
     ///   }
     ///   void foo() { bar(); }
-    ///   class foo
-    ///   {
+    ///   class foo {
     ///   };
     ///   if (foo()) {
-    ///   } else {
     ///   }
-    ///   enum X : int
-    ///   {
-    ///     A,
-    ///     B
-    ///   };
+    ///   else {
+    ///   }
+    ///   enum X : int { A, B };
     /// \endcode
     BS_Stroustrup,
     /// Always break before braces.
Index: docs/ClangFormatStyleOptions.rst
===================================================================
--- docs/ClangFormatStyleOptions.rst
+++ docs/ClangFormatStyleOptions.rst
@@ -901,27 +901,23 @@
       enum X : int { A, B };
 
   * ``BS_Stroustrup`` (in configuration: ``Stroustrup``)
-    Like ``Attach``, but break before function definitions, ``catch``, and
-    ``else``.
+    Always break before braces.
 
     .. code-block:: c++
 
       try {
         foo();
-      } catch () {
+      }
+      catch () {
       }
       void foo() { bar(); }
-      class foo
-      {
+      class foo {
       };
       if (foo()) {
-      } else {
       }
-      enum X : int
-      {
-        A,
-        B
-      };
+      else {
+      }
+      enum X : int { A, B };
 
   * ``BS_Allman`` (in configuration: ``Allman``)
     Always break before braces.
_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to