r196378 - Leave constructor initializer lists on one line in styles with no column limit.

Alexander Kornienko alexfh at google.com
Mon Dec 23 08:58:08 PST 2013


On Sat, Dec 21, 2013 at 7:50 PM, Nico Weber <thakis at chromium.org> wrote:

> On Sat, Dec 21, 2013 at 2:34 AM, Alexander Kornienko <alexfh at google.com>wrote:
>
>>
>>
>>
>> On Sat, Dec 21, 2013 at 11:32 AM, Alexander Kornienko <alexfh at google.com>wrote:
>>
>>> This patch should fix http://llvm-reviews.chandlerc.com/D2455
>>>
>>
>> Hit "Send" too early ;)
>>
>> This issue should be fixed by the patch here:
>> http://llvm-reviews.chandlerc.com/D2455. If you have comments, please
>> post them on the phab item.
>>
>
> Thanks for working on this! Once that patch is in, what's the difference
> in behavior between landing that and having r197386 in vs just reverting
> this change here (r196378)?
>

Clang-format didn't get this right before r196378:

$ echo "A():b(0),c(0) {}" | ~/work/cmake-clang-work/bin/clang-format
-style=webkit
A()
    : b(0)
    , c(0) {}


So the other patch (http://llvm-reviews.chandlerc.com/D2455) just fixes
this problem.

The effect of r196378 on the WebKit style was reverted by Florian Sowade's
patch (r197386). The sum of r196378 and r197386 also makes the "don't merge
constructors with initializer lists" decision dependent on
BreakConstructorInitializersBeforeComma instead of ColumnLimit, which is an
improvement, I think.


>
>>
>>
>>>
>>> On Tue, Dec 17, 2013 at 1:03 AM, Nico Weber <thakis at chromium.org> wrote:
>>>
>>>> On Mon, Dec 16, 2013 at 2:41 PM, Alexander Kornienko <alexfh at google.com
>>>> > wrote:
>>>>
>>>>> On Mon, Dec 16, 2013 at 9:21 PM, Nico Weber <thakis at chromium.org>wrote:
>>>>>
>>>>>> Thanks!
>>>>>>
>>>>>> Current head now does:
>>>>>> thakis$ echo "A():b(0),c(0) {}" | Release+Asserts/bin/clang-format
>>>>>>  -style=WebKit
>>>>>> A()
>>>>>>     : b(0)
>>>>>>     , c(0) {}
>>>>>>
>>>>>> The {} is still wrong according to
>>>>>> http://www.webkit.org/coding/coding-style.html "Function
>>>>>> definitions: place each brace on its own line."
>>>>>>
>>>>>
>>>>> Does WebKit style allow short (0-1 statements) function bodies on a
>>>>> single line?
>>>>>
>>>>
>>>> In my interpretation of the style guide this isn't allowed ("Function
>>>> definitions: place each brace on its own line."). In practice, inline
>>>> definitions of short methods in classes are on single lines often.
>>>>
>>>> For regular toplevel methods, both braces are always on their own line
>>>> each almost always (according to `find Source/core/ -name '*.cpp' | xargs
>>>> ack '\{.*\}'`)
>>>>
>>>>
>>>>>  If no, the solution is just to turn off the corresponding flag for
>>>>> the WebKit style. If yes, we should probably refrain from joining lines in
>>>>> constructor with initializer lists,
>>>>> when BreakConstructorInitializersBeforeComma is true.
>>>>>
>>>>
>>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20131223/b776ec1f/attachment.html>


More information about the cfe-commits mailing list