r181700 - Implements brace breaking styles.

Sean Silva silvas at purdue.edu
Mon May 13 23:18:01 PDT 2013


On Mon, May 13, 2013 at 6:51 AM, Manuel Klimek <klimek at google.com> wrote:

> Author: klimek
> Date: Mon May 13 07:51:40 2013
> New Revision: 181700
>
> URL: http://llvm.org/viewvc/llvm-project?rev=181700&view=rev
> Log:
> Implements brace breaking styles.
>
> We now support "Linux" and "Stroustrup" brace breaking styles, which
> gets us one step closer to support formatting WebKit, KDE & Linux code.
>
> Linux brace breaking style:
> namespace a
> {
> class A
> {
>   void f()
>   {
>     if (x) {
>       f();
>     } else {
>       g();
>     }
>   }
> }
> }
>
> Stroustrup brace breaking style:
> namespace a {
> class A {
>   void f()
>   {
>     if (x) {
>       f();
>     } else {
>       g();
>     }
>   }
> }
> }
>
> Modified:
>     cfe/trunk/include/clang/Format/Format.h
>     cfe/trunk/lib/Format/Format.cpp
>     cfe/trunk/lib/Format/UnwrappedLineParser.cpp
>     cfe/trunk/unittests/Format/FormatTest.cpp
>
> Modified: cfe/trunk/include/clang/Format/Format.h
> URL:
> http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Format/Format.h?rev=181700&r1=181699&r2=181700&view=diff
>
> ==============================================================================
> --- cfe/trunk/include/clang/Format/Format.h (original)
> +++ cfe/trunk/include/clang/Format/Format.h Mon May 13 07:51:40 2013
> @@ -101,6 +101,20 @@ struct FormatStyle {
>    /// tab characters.
>    bool UseTab;
>
> +  /// \brief Different ways to attach braces to their surrounding context.
> +  enum BraceBreakingStyle {
> +    /// Always attach braces to surrounding context.
> +    BS_Attach,
> +    /// Like \c Attach, but break before braces on function, namespace and
> +    /// class definitions.
> +    BS_Linux,
>

How exactly do "namespace and class definitions" come into play with Linux
code (all C)? Seems confusing to name it like that.

-- Sean Silva
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20130514/b7ceb761/attachment.html>


More information about the cfe-commits mailing list