On Tue, May 14, 2013 at 1:59 AM, Manuel Klimek <[email protected]> wrote:

> On Tue, May 14, 2013 at 8:18 AM, Sean Silva <[email protected]> wrote:
>
>> On Mon, May 13, 2013 at 6:51 AM, Manuel Klimek <[email protected]> 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.
>>
>
> astyle calls this kind of breaking "Linux". If you can come up with a
> better name I'm open to changing it.
>
>
Ah, I wasn't aware of the precedent.

-- Sean Silva
_______________________________________________
cfe-commits mailing list
[email protected]
http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits

Reply via email to