[PATCH] D34395: clang-format: add options to merge empty record body

Francois Ferrand via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Tue Jun 20 04:45:11 PDT 2017


Typz created this revision.
Herald added a subscriber: klimek.

This patch introduces a few extra BraceWrapping options, similar to
`SplitEmptyFunction`, to allow merging empty 'record' bodies (e.g.
class, struct, union and namespace):

- SplitEmptyClass
- SplitEmptyStruct
- SplitEmptyUnion
- SplitEmptyNamespace

The `SplitEmptyFunction` option name has also been simplified/
shortened (from `SplitEmptyFunctionBody`).

These options are helpful when the correspond AfterXXX option is
enabled, to allow merging the empty record:

  class Foo
  {};

In addition, this fixes an unexpected merging of short records, when
the AfterXXXX options are used, which caused to be formatted like
this:

  class Foo
  { void Foo(); };

This is now properly formatted as:

  class Foo
  {
     void Foo();
  };


https://reviews.llvm.org/D34395

Files:
  include/clang/Format/Format.h
  lib/Format/Format.cpp
  lib/Format/FormatToken.h
  lib/Format/UnwrappedLineFormatter.cpp
  unittests/Format/FormatTest.cpp

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D34395.103186.patch
Type: text/x-patch
Size: 14266 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20170620/e763ab70/attachment-0001.bin>


More information about the cfe-commits mailing list