Commit Graph

4 Commits

Author SHA1 Message Date
Giuliano Procida
cb1c49e126 clang-format: set continuation indentation to 2
This is a further tweak to the clang-format rules, bringing them
(on average) closer to the existing corpus of code.

The existing code mostly uses an indentaton of 2 spaces, rather than
4, for expressions broken across lines. There are exceptions such as
conditional expressions that are initialisers but clang-format's
indentation may be preferable to emacs' zero indentation here.

	* .clang-format: Set ContinuationIndentWidth to 2.

Signed-off-by: Giuliano Procida <gprocida@google.com>
2020-05-18 10:48:09 +02:00
Matthias Maennich
06fef19000 clang-format: Better approximation for binary operators and assignments
The project style requires assignment operators to be on the first line
of two if the line needs to break. Reflect that in the .clang-format
configuration to approximate the style better when using clang-format.

	* .clang-format: Add BreakBeforeBinaryOperators option.

Signed-off-by: Matthias Maennich <maennich@google.com>
2020-01-21 18:38:04 +00:00
Matthias Maennich
fb70149cb1 .clang-format: Add more options for match existing coding style
Add options for constructor intializers, using declarations and
consecutive declarations.

Even though sorting using declarations could be useful, it changes too
much existing code as of now.

	* .clang-format: Add options for ConstructorInitializers
	Set SortUsingDeclarations=false
	Set AlignConsecutiveDeclarations=true

Signed-off-by: Matthias Maennich <maennich@google.com>
2019-05-22 14:34:31 +02:00
Matthias Maennich
9c84181f99 Add .clang-format approximation
Add .clang-format definitions that are an approximation of the current
coding style. As I understand it, the current style is based on what GNU
Emacs implements for C++. Hence these rules might not be entirely
accurate, but a good-enough approximation to allow contributers to
follow the coding style more easily.

I expect modifications for specific cases and when clang-format itself
evolves over time.

As of now, this definition is most useful in partial code formatting,
such as executed by `git clang-format` on staged files or
clang-format.py as a means of integration into various editors.

	* .clang-format: New File.

Signed-off-by: Matthias Maennich <maennich@google.com>
2019-05-20 10:03:49 +02:00