-
Notifications
You must be signed in to change notification settings - Fork 0
/
.clang-format
113 lines (102 loc) · 3.84 KB
/
.clang-format
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
---
## General
Language: Cpp
Standard: Cpp11
ColumnLimit: 120
IndentWidth: 2
UseTab: Never
BreakBeforeBraces: Custom
BraceWrapping:
AfterClass: false
AfterControlStatement: false
AfterEnum: false
AfterFunction: false
AfterNamespace: false
AfterStruct: false
AfterUnion: false
AfterExternBlock: false
BeforeCatch: false
BeforeElse: false
IndentBraces: false
SplitEmptyFunction: false
SplitEmptyRecord: false
SplitEmptyNamespace: false
## Single liners
# Disallow all single liners, except for empty functions and
# single-statement member functions.
AllowShortBlocksOnASingleLine: false
AllowShortCaseLabelsOnASingleLine: false
AllowShortFunctionsOnASingleLine: Inline
AllowShortIfStatementsOnASingleLine: false
AllowShortLoopsOnASingleLine: false
## Line breaks
# Rule of thumb is prefer one per line if wrapping is required,
# rather than move all parameters to the next line or bin packing.
AlignAfterOpenBracket: Align
AllowAllParametersOfDeclarationOnNextLine: false
AlwaysBreakAfterReturnType: None
AlwaysBreakBeforeMultilineStrings: false
AlwaysBreakTemplateDeclarations: true
BinPackArguments: false
BinPackParameters: false
BreakBeforeBinaryOperators: NonAssignment
BreakBeforeTernaryOperators: true
BreakConstructorInitializers: BeforeColon
BreakInheritanceList: BeforeColon # Requires clang-format-7
BreakStringLiterals: true
ConstructorInitializerAllOnOneLineOrOnePerLine: true
## Alignment
# Rule of thumb: Align lines with eachother to improve readability
AlignConsecutiveAssignments: true
AlignConsecutiveDeclarations: true
AlignEscapedNewlines: Left
AlignOperands: true
## Pointer alignment
DerivePointerAlignment: false
PointerAlignment: Left
## Indentation
AccessModifierOffset: -2
ConstructorInitializerIndentWidth: 4
ContinuationIndentWidth: 4
IndentCaseLabels: true
IndentPPDirectives: None
IndentWrappedFunctionNames: true
NamespaceIndentation: None
## Sorting
IncludeBlocks: Preserve
SortIncludes: true
SortUsingDeclarations: true
## Spaces
Cpp11BracedListStyle: true
SpaceAfterCStyleCast: true
SpaceAfterTemplateKeyword: true
SpaceBeforeAssignmentOperators: true
SpaceBeforeParens: ControlStatements
SpaceInEmptyParentheses: false
SpacesInAngles: false
SpacesInCStyleCastParentheses: false
SpacesInContainerLiterals: false
SpacesInParentheses: false
SpacesInSquareBrackets: false
SpaceBeforeCpp11BracedList: true # Requires clang-format-7
SpaceBeforeCtorInitializerColon: true # Requires clang-format-7
SpaceBeforeInheritanceColon: true # Requires clang-format-7
SpaceBeforeRangeBasedForLoopColon: true # Requires clang-format-7
## Comments
AlignTrailingComments: true
ReflowComments: true
SpacesBeforeTrailingComments: 2
## Misc
CompactNamespaces: false
FixNamespaceComments: true
KeepEmptyLinesAtTheStartOfBlocks: true
MaxEmptyLinesToKeep: 2
## "AllOnOneLineOrOnePerLine" for assignments.
# Example: Prefer the left over the right:
#
# int foo = bar(aaaaaaa, int foo =
# bbbbbbb, bar(aaaaaaa, bbbbbbb, ccccccc);
# ccccccc);
PenaltyBreakAssignment: 1000
PenaltyBreakBeforeFirstCallParameter: 1000
...