.clang-format: update for clang-format 13
authorPhilippe Proulx <eeppeliteloop@gmail.com>
Thu, 27 Jan 2022 03:02:37 +0000 (22:02 -0500)
committerPhilippe Proulx <eeppeliteloop@gmail.com>
Fri, 28 Jan 2022 16:22:26 +0000 (11:22 -0500)
commitff7ea753d4069f125953d690df066c5b8c83e4c2
treee2294d7d8cf14aeec5969ba52f9d7217d2b30805
parent2bf8d3246aba9009042c293bb0154c7738e47ae3
.clang-format: update for clang-format 13

This patch adds missing clang-format options for clang-format 11 to 13,
as the project now requires clang-format 13.

Notable changes:

* The `AttributeMacros` and `ForEachMacros` lists make clang-format
  aware of those identifiers as attributes and for-each macros so that
  its formatting is more consistent.

  For example,

      bt_list_for_each(pos, head) {
          // ...
      }

  becomes

      bt_list_for_each (pos, head) {
          // ...
      }

* `EmptyLineBeforeAccessModifier` set to `Always` makes sure there's
  always an empty line before an access modifier line
  (`public`/`protected`/`private`).

* `SpaceAroundPointerQualifiers` set to `Both` makes qualifiers such as
  `const` get spaces at their left and right, for example
  `const Hello * const *hello`.

* `SpaceInEmptyBlock` set to `true` makes empty blocks contain a single
  space instead of none (`{ }` instead of `{}`).

* `ReferenceAlignment` set to `Left` makes the `&` of references on the
  left side: `const Hello& hello`.

  Having this makes it possible to set `PointerAlignment` to `Right` so
  that pointers look like they always looked in Babeltrace:
  `const Hello *hello`.

`AlignArrayOfStructures` set to `Left` would be nice but I'm getting
bugs (crashes and wrong formatting) with it as of clang-format 13.0.0
(see <https://bugs.llvm.org/show_bug.cgi?id=52463> and
<https://bugs.llvm.org/show_bug.cgi?id=52425>), therefore I'm leaving it
to `None` until it's fixed.

Signed-off-by: Philippe Proulx <eeppeliteloop@gmail.com>
Change-Id: I743d630242de0cd222df3ac8a932f8b48ff61125
Reviewed-on: https://review.lttng.org/c/babeltrace/+/7150
Reviewed-by: Simon Marchi <simon.marchi@efficios.com>
Tested-by: jenkins <jenkins@lttng.org>
.clang-format
CONTRIBUTING.adoc
This page took 0.025218 seconds and 4 git commands to generate.