[PATCH] D14484: Formatting constructor initializer lists by putting them always on different lines

JVApen via cfe-commits cfe-commits at lists.llvm.org
Sun Nov 8 00:04:58 PST 2015


JVApen created this revision.
JVApen added a reviewer: djasper.
JVApen added a subscriber: cfe-commits.
JVApen set the repository for this revision to rL LLVM.
Herald added a subscriber: klimek.

Hi all,

I've been playing around with the clang for a while now and really enjoy it. Unfortunately clang-format does not yet do what I like it to do, so I started hacking it. So here is my first successful attempt to get something working.

The issue: ConstructorInitializerAllOnOneLineOrOnePerLine only works if 'If the constructor initializers don’t fit on a line', while I prefer it to always work. In other words, I use the following formatting:

```
Constructor()
  : a(a)
  , b(b)
```

Since everyone can benefit from upstreaming, I like to share my changes and get some feedback.
Here is already some of the stuff which I was uncertain about:

  - Should I keep ConstructorInitializerAllOnOneLineOrOnePerLine or rename it (currently the second one)
  - How to name the values, currently: Compact (old: false), BestFit (old: true), OnePerLine (new)
  - Is the back-ward compatibility in ScalarEnumerationTraits a good idea? (On rename most likely not)

JVApen



Repository:
  rL LLVM

http://reviews.llvm.org/D14484

Files:
  docs/ClangFormatStyleOptions.rst
  include/clang/Format/Format.h
  lib/Format/ContinuationIndenter.cpp
  lib/Format/Format.cpp
  lib/Format/TokenAnnotator.cpp
  unittests/Format/FormatTest.cpp

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D14484.39647.patch
Type: text/x-patch
Size: 13225 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20151108/139318fc/attachment-0001.bin>


More information about the cfe-commits mailing list