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>
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>
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>
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>