-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path.clang-format
212 lines (190 loc) · 5.93 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
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
---
# Options are separated by clang-format version
# If an option is too new, clang tidy will fail
# clang-format 3.3
AccessModifierOffset: -4
AllowAllParametersOfDeclarationOnNextLine: true
AllowShortIfStatementsOnASingleLine: WithoutElse
IndentCaseLabels: true
# clang-format 3.4
AlwaysBreakBeforeMultilineStrings: false
AlwaysBreakTemplateDeclarations: Yes
Cpp11BracedListStyle: true
SpacesInAngles: false
# clang-format 3.5
AlignOperands: AlignAfterOperator
AllowShortBlocksOnASingleLine: Empty
AllowShortFunctionsOnASingleLine: Empty
Language: Cpp
SpaceAfterCStyleCast: false
SpaceBeforeParens: ControlStatements
# clang-format 3.6
AllowShortCaseLabelsOnASingleLine: true
BreakBeforeBinaryOperators: NonAssignment # NOTE: this works with AlignOperands
# clang-format 3.7
# AlignTrailingComments: true # NOTE: clang-format 16 expands this option, see below
AllowShortLoopsOnASingleLine: false
# AlwaysBreakAfterDefinitionReturnType: None # NOTE: Deprecated
BinPackArguments: false
BinPackParameters: false
BreakBeforeBraces: Attach
BreakBeforeTernaryOperators: true
ColumnLimit: 120
CommentPragmas: "^ IWYU pragma:" # TODO: add cppcheck and clang-tidy directives
# ConstructorInitializerAllOnOneLineOrOnePerLine: true # NOTE: Deprecated
ConstructorInitializerIndentWidth: 8
ContinuationIndentWidth: 4
DerivePointerAlignment: false # NOTE: see PointerAlignment
DisableFormat: false
ExperimentalAutoDetectBinPacking: false
ForEachMacros: []
IndentWidth: 4
IndentWrappedFunctionNames: true
KeepEmptyLinesAtTheStartOfBlocks: true
MacroBlockBegin: ""
MacroBlockEnd: ""
MaxEmptyLinesToKeep: 3
NamespaceIndentation: Inner
ObjCBlockIndentWidth: 8
ObjCSpaceAfterProperty: false
ObjCSpaceBeforeProtocolList: false
PenaltyBreakBeforeFirstCallParameter: 50
PenaltyBreakComment: 100
PenaltyBreakFirstLessLess: 0
PenaltyBreakString: 1000
PenaltyExcessCharacter: 10
PenaltyReturnTypeOnItsOwnLine: 100
PointerAlignment: Right
SpaceBeforeAssignmentOperators: true
SpaceInEmptyParentheses: false
SpacesBeforeTrailingComments: 2
SpacesInCStyleCastParentheses: false
SpacesInContainerLiterals: true
SpacesInParentheses: false
SpacesInSquareBrackets: false
Standard: c++17
TabWidth: 4
UseTab: Never
# clang-format 3.8
AlignAfterOpenBracket: DontAlign
AlignConsecutiveAssignments: None
AlignConsecutiveDeclarations: None
AlwaysBreakAfterReturnType: None
# BraceWrapping: [] # NOTE: For BreakBeforeBraces: Custom
BreakAfterJavaFieldAnnotations: true
IncludeCategories: # NOTE: order: user includes -> system includes -> Qt includes -> standard includes
- Regex: "<[a-z_]+>"
Priority: 4
- Regex: "<Q[a-zA-Z_]+>"
Priority: 3
- Regex: "<.+>"
Priority: 2
- Regex: '".+"'
Priority: 1
# clang-format 3.8
BreakStringLiterals: false
IncludeIsMainRegex: "((_test)|(_impl)|(ui_))?$"
JavaScriptQuotes: Double
JavaScriptWrapImports: true
# clang-format 4
ReflowComments: true
SortIncludes: CaseInsensitive
SpaceAfterTemplateKeyword: false
# clang-format 5
AlignEscapedNewlines: Left
BreakConstructorInitializers: BeforeComma
CompactNamespaces: false
FixNamespaceComments: true # NOTE: see ShortNamespaceLines
PenaltyBreakAssignment: 20
SortUsingDeclarations: true
# clang-format 6
IncludeBlocks: Regroup
IndentPPDirectives: AfterHash
RawStringFormats: []
# clang-format 7
BreakInheritanceList: BeforeComma
ObjCBinPackProtocolList: Auto
PenaltyBreakTemplateDeclaration: 1000
SpaceBeforeCpp11BracedList: true
SpaceBeforeCtorInitializerColon: false
SpaceBeforeInheritanceColon: true
SpaceBeforeRangeBasedForLoopColon: true
# clang-format 8
JavaImportGroups: []
StatementMacros: ["PropertyGet", "PropertyGetSet"]
# clang-format 9
AlignConsecutiveMacros: Consecutive
AllowAllArgumentsOnNextLine: false
# AllowAllConstructorInitializersOnNextLine: false # NOTE: Deprecated
AllowShortLambdasOnASingleLine: Inline
NamespaceMacros: []
SpaceAfterLogicalNot: false
TypenameMacros: []
# clang-format 10
DeriveLineEnding: false
IncludeIsMainSourceRegex: '\.ipp' # NOTE: see IncludeIsMainRegex
IndentGotoLabels: false
SpaceBeforeSquareBrackets: false
SpaceInEmptyBlock: true
SpacesInConditionalStatement: false
UseCRLF: false
# clang-format 11
AlignConsecutiveBitFields: AcrossEmptyLinesAndComments
AllowShortEnumsOnASingleLine: true
IndentCaseBlocks: false
IndentExternBlock: NoIndent
InsertTrailingCommas: Wrapped
ObjCBreakBeforeNestedBlockParam: false
WhitespaceSensitiveMacros: [Q_OBJECT, Q_PROPERTY]
# clang-format 12
AttributeMacros: []
BitFieldColonSpacing: After
BreakBeforeConceptDeclarations: true # NOTE: clang format docs suggest it shoudl be "Always" instead, but that gives an error
EmptyLineBeforeAccessModifier: Leave
# IndentRequires: false # NOTE: renamed IndentRequiresClause in clang-format 15
PenaltyIndentedWhitespace: 0
SortJavaStaticImport: Before
SpaceAroundPointerQualifiers: Default
SpaceBeforeCaseColon: false
StatementAttributeLikeMacros: []
# clang-format 13
AlignArrayOfStructures: Right
EmptyLineAfterAccessModifier: Leave
IfMacros: []
IndentAccessModifiers: false
LambdaBodyIndentation: OuterScope
PPIndentWidth: -1 # NOTE: same as IndentWidth
ReferenceAlignment: Right
ShortNamespaceLines: 7
SpacesInLineCommentPrefix:
Minimum: 1
Maximum: -1
# Clang-format 14
PackConstructorInitializers: Never
PenaltyBreakOpenParenthesis: 0
QualifierAlignment: Custom
QualifierOrder:
["static", "inline", "constexpr", "volatile", "type", "const", "restrict"]
RemoveBracesLLVM: false
SeparateDefinitionBlocks: Always
# SpaceBeforeParensOptions: [] # NOTE: For SpaceBeforeParens: Custom
# Clang-format 15
IndentRequiresClause: false # NOTE: used to be IndentRequires
InsertBraces: false
RequiresClausePosition: OwnLine
# Clang-format 16
AlignTrailingComments: # NOTE: can be a boolean as of 3.7
Kind: Always
OverEmptyLines: 1
BreakAfterAttributes: Always
BreakArrays: false # JSON
BreakBeforeInlineASMColon: OnlyMultiline
InsertNewlineAtEOF: true
IntegerLiteralSeparator:
Binary: 8
Decimal: 3
DecimalMinDigits: 6
Hex: 0
LineEnding: DeriveLF # If unclear, default to LF
RemoveSemicolon: false
RequiresExpressionIndentation: OuterScope