Update the example of BS_Stroustrup to match what is done by clang-format
authorSylvestre Ledru <sylvestre@debian.org>
Fri, 26 Oct 2018 07:25:37 +0000 (07:25 +0000)
committerSylvestre Ledru <sylvestre@debian.org>
Fri, 26 Oct 2018 07:25:37 +0000 (07:25 +0000)
Summary:
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

Reviewers: krasimir

Reviewed By: krasimir

Subscribers: cfe-commits

Differential Revision: https://reviews.llvm.org/D53520

llvm-svn: 345371

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

index d50c883..6b7c578 100644 (file)
@@ -908,20 +908,17 @@ the configuration (without a prefix: ``Auto``).
 
       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 b777496..cb37b0c 100644 (file)
@@ -533,20 +533,17 @@ struct FormatStyle {
     /// \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.