[PATCH] D58941: [clang-format][docs][NFC] Fix example for Allman brace breaking style

Jan Korous via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Mon Mar 4 17:23:42 PST 2019


jkorous created this revision.
jkorous added reviewers: JDevlieghere, krasimir, benhamilton.
Herald added subscribers: cfe-commits, dexonsmith.
Herald added a project: clang.

I assume the example is wrong as it's clearly missing line-breaks before braces. That's about my level of understanding and I am totally oblivious to any finer details.

I just ran the example through clang-format with .clang-format like this:

BreakBeforeBraces: Allman


Repository:
  rC Clang

https://reviews.llvm.org/D58941

Files:
  clang/docs/ClangFormatStyleOptions.rst


Index: clang/docs/ClangFormatStyleOptions.rst
===================================================================
--- clang/docs/ClangFormatStyleOptions.rst
+++ clang/docs/ClangFormatStyleOptions.rst
@@ -925,19 +925,28 @@
 
     .. code-block:: c++
 
-      try {
+      try
+      {
         foo();
       }
-      catch () {
+      catch ()
+      {
       }
       void foo() { bar(); }
-      class foo {
+      class foo
+      {
       };
-      if (foo()) {
+      if (foo())
+      {
       }
-      else {
+      else
+      {
       }
-      enum X : int { A, B };
+      enum X : int
+      {
+        A,
+        B
+      };
 
   * ``BS_GNU`` (in configuration: ``GNU``)
     Always break before braces and add an extra level of indentation to


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D58941.189242.patch
Type: text/x-patch
Size: 756 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20190305/9b83fe77/attachment.bin>


More information about the cfe-commits mailing list