2022-01-20 04:44:45 +08:00
|
|
|
# For more information, see:
|
|
|
|
#
|
|
|
|
# https://clang.llvm.org/docs/ClangFormat.html
|
|
|
|
# https://clang.llvm.org/docs/ClangFormatStyleOptions.html
|
|
|
|
#
|
|
|
|
---
|
|
|
|
|
2022-03-15 01:01:54 +08:00
|
|
|
BasedOnStyle: GNU
|
|
|
|
|
2022-01-20 04:44:45 +08:00
|
|
|
AlignAfterOpenBracket: Align
|
2022-01-20 06:17:23 +08:00
|
|
|
AlignArrayOfStructures: Left
|
2022-01-20 04:44:45 +08:00
|
|
|
AlignConsecutiveAssignments: Consecutive
|
|
|
|
AlignConsecutiveDeclarations: Consecutive
|
2022-01-20 06:17:23 +08:00
|
|
|
AlignConsecutiveMacros: Consecutive
|
|
|
|
AlignEscapedNewlines: Left
|
|
|
|
|
2022-03-15 01:01:54 +08:00
|
|
|
AllowAllParametersOfDeclarationOnNextLine: false
|
2022-01-20 04:44:45 +08:00
|
|
|
AlwaysBreakAfterReturnType: AllDefinitions
|
2022-03-15 01:01:54 +08:00
|
|
|
BinPackParameters: false
|
2022-01-20 06:17:23 +08:00
|
|
|
BreakBeforeBraces: GNU
|
2022-01-20 04:44:45 +08:00
|
|
|
IndentWidth: 2
|
2022-01-20 06:17:23 +08:00
|
|
|
PointerAlignment: Right
|
|
|
|
UseTab: Never
|
|
|
|
|
2022-03-15 01:01:54 +08:00
|
|
|
SpaceBeforeParens: Always
|
|
|
|
SpaceAfterLogicalNot: true
|
|
|
|
SpaceAfterCStyleCast: true
|
|
|
|
|
2022-01-20 06:17:23 +08:00
|
|
|
# Our column limit is more around 80 characters but we want to avoid
|
|
|
|
# this rule to be over-agressive. So for clang-format, let's use a
|
|
|
|
# higher limit. Then let's put some biggish penalties on breaking on
|
|
|
|
# assignment, or parentheses, or other similar cases. Actually with such
|
|
|
|
# limits, if clang-format really ends up re-formatting, there might be
|
|
|
|
# something better to do code-wise (i.e. we might be in an akwardly
|
|
|
|
# over-nested block case).
|
2022-03-15 01:01:54 +08:00
|
|
|
ColumnLimit: 80
|
|
|
|
PenaltyBreakAssignment: 60
|
|
|
|
PenaltyBreakBeforeFirstCallParameter: 100
|
|
|
|
PenaltyBreakString: 60
|
2022-01-20 06:17:23 +08:00
|
|
|
# Uncomment this when we start using clang-format 14 in the CI.
|
|
|
|
# PenaltyBreakOpenParenthesis: 40
|
|
|
|
PenaltyExcessCharacter: 1
|
|
|
|
# Strings are more often longer by usage, so let's give these slightly
|
|
|
|
# more space to breath.
|
|
|
|
PenaltyBreakString: 60
|
|
|
|
PenaltyReturnTypeOnItsOwnLine: 50
|