[cfe-dev] clang-format: Incorrect BreakBeforeBraces documentation

Matthew Fernandez via cfe-dev cfe-dev at lists.llvm.org
Wed Sep 13 18:11:57 PDT 2017


Hello cfe-dev,

If this is not the right place for reporting issues with clang-format, please let me know where I should post this instead.

The docs for the BreakBeforeBraces option of clang-format style [0] give the following example of Allman bracing:

     try {
       foo();
     }
     catch () {
     }
     void foo() { bar(); }
     class foo {
     };
     if (foo()) {
     }
     else {
     }
     enum X : int { A, B };

This does not seem to be Allman style. In fact clang-format itself will reflow this example:

     $ clang-format -style="{BreakBeforeBraces: Allman}" allman.cpp
     try
     {
       foo();
     }
     catch ()
     {
     }
     void foo() { bar(); }
     class foo
     {
     };
     if (foo())
     {
     }
     else
     {
     }
     enum X : int
     {
       A,
       B
     };

Is this a mistake in the documentation?

Thanks,
Matt

   [0]: https://clang.llvm.org/docs/ClangFormatStyleOptions.html



More information about the cfe-dev mailing list