r181700 - Implements brace breaking styles.
Sean Silva
silvas at purdue.edu
Tue May 14 11:21:03 PDT 2013
On Tue, May 14, 2013 at 1:59 AM, Manuel Klimek <klimek at google.com> wrote:
> On Tue, May 14, 2013 at 8:18 AM, Sean Silva <silvas at purdue.edu> wrote:
>
>> 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.
>>
>
> 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
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20130514/7c1d3a24/attachment.html>
More information about the cfe-commits
mailing list