[PATCH] [ClangFormat] Add ConstructorInitializerOffset to control initializer list indentation

Manuel Klimek klimek at google.com
Tue Aug 13 02:01:51 PDT 2013


On Tue, Aug 13, 2013 at 1:48 AM, Klemens Baum <klemensbaum at gmail.com> wrote:

>
>   For the Phrabricator issue: I tried uploading a full-context diff [here](
> http://llvm-reviews.chandlerc.com/differential/diff/3416/). If you expand
> FormatTest.cpp, you'll see that it gets truncated at line 5782.
>

Can you give me the command line you used to generate the patch, then I'll
file an upstream bug. Thanks!


>
>
> ================
> Comment at: ../tools/clang/lib/Format/Format.cpp:656
> @@ +655,3 @@
> +      } else if (Current.Type == TT_CtorInitializerComma) {
> +        assert(Style.BreakConstructorInitializersBeforeComma);
> +        State.Column = State.Stack.back().Indent;
> ----------------
> Daniel Jasper wrote:
> > Klemens Baum wrote:
> > > Daniel Jasper wrote:
> > > > Do not assert!!! This is easy to force by user input, e.g. by:
> > > >
> > > >   Constructor::Constructor() : a(a) // a
> > > >   , b(b) {}
> > > >
> > > > It's fine not to format perfectly in that case, but we shouldn't
> crash.
> > > Since this whole block is within the `if (Newline)`, `Current` refers
> to the first token to emit on that line. Unless we are using the
> BreakConstructorInitializersBeforeComma style, it cannot be an initializer
> list comma token. So I don't think this can be triggered by user input.
> > Well, I have given you the user input that triggers it.
> Oh, right. I didn't realize that comment was there.
>
>
> http://llvm-reviews.chandlerc.com/D1360
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20130813/9430bebb/attachment.html>


More information about the cfe-commits mailing list