[PATCH] add option to break constructor initializers before colon

Alexander Kornienko alexfh at google.com
Mon Dec 16 06:42:18 PST 2013


Looks good. Thanks for the patch!

I've fixed a couple of nits and committed it as r197386.


On Mon, Dec 16, 2013 at 11:46 AM, Florian Sowade <f.sowade at r9e.de> wrote:

> Hi,
>
> On Sun, 2013-12-08 at 21:32 +0100, Daniel Jasper wrote:
> > I think we might just want to change the existing
> > option BreakConstructorInitializersBeforeComma to do exactly this. WebKit
> > style is the only style using it and I agree that the style guide is
> > explicit in this regard.
>
> that seems reasonable to me. Please find attached a patch which
> implements that behavior.
>
> Unlike the old one, the new patch also works if ColumnLimit is 0, so it
> does work for WebKit, too.
>
> Florian Sowade
>
> > On Thu, Dec 5, 2013 at 10:50 PM, Nico Weber <thakis at chromium.org> wrote:
> >
> > > (This is what WebKit style asks for too:
> > > http://www.webkit.org/coding/coding-style.html , "Other Punctuation"
> > > point 1. So if this goes in, maybe you can set to true for webkit
> style.)
> > >
> > >
> > > On Thu, Dec 5, 2013 at 10:23 AM, Florian Sowade <f.sowade at r9e.de>
> wrote:
> > >
> > >> Hi,
> > >>
> > >> the attached patch adds a clang-format option to always break
> > >> constructor initializers before the initial colon.
> > >>
> > >> So this patch adds an option to turn
> > >>
> > >> Constructor : foo(bar)
> > >> {}
> > >>
> > >> into
> > >>
> > >> Constructor
> > >>     : foo(bar)
> > >> {}
> > >>
> > >> I don't know if this style is widely distributed, but I use it to
> > >> minimize the diff when I add new members to the list of constructor
> > >> initializers, since I can add a second member to the list without
> > >> modifying any of the existing lines:
> > >>
> > >> Constructor
> > >>     : foo(bar)
> > >>     , baz()
> > >> {}
> > >>
> > >> From my understanding this is not possible with the current set of
> > >> options.
> > >>
> > >> Florian Sowade
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20131216/c2b19af1/attachment.html>


More information about the cfe-commits mailing list