[PATCH] D108752: [clang-format] Group options that pack constructor initializers

Owen Pan via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Thu Aug 26 01:36:38 PDT 2021


owenpan created this revision.
owenpan added reviewers: djasper, klimek, krasimir, MyDeveloperDay, curdeius, HazardyKnusperkeks.
owenpan added a project: clang-format.
owenpan requested review of this revision.
Herald added a project: clang.
Herald added a subscriber: cfe-commits.

Add a new option `PackConstructorInitializers` and deprecate the related options `ConstructorInitializerAllOnOneLineOrOnePerLine` and `AllowAllConstructorInitializersOnNextLine`. Below is the mapping:

  PackConstructorInitializers  ConstructorInitializer... AllowAll...
          Never                            -                  -
          BinPack                        false                -
          CurrentLine                    true               false
          NextLine                       true               true

The option value `Never` fixes PR50549 <https://bugs.llvm.org/show_bug.cgi?id=50549> by always placing each constructor initializer on its own line. Please see D105099 <https://reviews.llvm.org/D105099> for previous discussions.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D108752

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

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D108752.368828.patch
Type: text/x-patch
Size: 26858 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20210826/170b8b69/attachment-0001.bin>


More information about the cfe-commits mailing list