-
Notifications
You must be signed in to change notification settings - Fork 0
/
.clang-format
351 lines (257 loc) · 10.7 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
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
---
# Programming language.
Language: Cpp
# The extra indent or outdent of access modifiers, e.g. public:.
AccessModifierOffset: -4
# If true, horizontally aligns arguments after an open bracket.
AlignAfterOpenBracket: DontAlign
# Style of aligning consecutive macro definitions.
AlignConsecutiveMacros: false
# Style of aligning consecutive assignments.
AlignConsecutiveAssignments: false
# Style of aligning consecutive declarations.
AlignConsecutiveDeclarations: false
# Options for aligning backslashes in escaped newlines.
AlignEscapedNewlines: Right
# If true, horizontally align operands of binary and ternary expressions.
AlignOperands: false
# If true, aligns trailing comments.
AlignTrailingComments: true
# If a function call or braced initializer list doesn’t fit on a line, allow
# putting all arguments onto the next line, even if BinPackArguments is false.
AllowAllArgumentsOnNextLine: false
# If the function declaration doesn’t fit on a line, allow putting all
# parameters of a function declaration onto the next line even if
# BinPackParameters is false.
AllowAllParametersOfDeclarationOnNextLine: false
# Dependent on the value, while (true) { continue; } can be put on a single
# line.
AllowShortBlocksOnASingleLine: Never
# If true, short case labels will be contracted to a single line.
AllowShortCaseLabelsOnASingleLine: false
# Dependent on the value, int f() { return 0; } can be put on a single line.
AllowShortFunctionsOnASingleLine: All
# Dependent on the value, auto lambda []() { return 0; } can be put on a single
# line.
AllowShortLambdasOnASingleLine: All
# Dependent on the value, if (a) return; can be put on a single line.
AllowShortIfStatementsOnASingleLine: Never
# If true, while (true) continue; can be put on a single line.
AllowShortLoopsOnASingleLine: false
# The function definition return type breaking style to use. This option is
# deprecated and is retained for backwards compatibility.
AlwaysBreakAfterDefinitionReturnType: None
# The function declaration return type breaking style to use.
AlwaysBreakAfterReturnType: None
# If true, always break before multiline string literals.
AlwaysBreakBeforeMultilineStrings: false
# The template declaration breaking style to use.
AlwaysBreakTemplateDeclarations: Yes
# If false, a function call’s arguments will either be all on the same line or
# will have one line each.
BinPackArguments: false
# Control of individual brace wrapping cases.
BraceWrapping:
AfterCaseLabel: true
AfterClass: true
AfterControlStatement: true
AfterEnum: true
AfterFunction: true
AfterNamespace: true
AfterObjCDeclaration: true
AfterStruct: true
AfterUnion: true
AfterExternBlock: true
BeforeCatch: true
BeforeElse: true
BeforeLambdaBody: true
BeforeWhile: true
IndentBraces: false
SplitEmptyFunction: true
SplitEmptyRecord: true
SplitEmptyNamespace: true
# The way to wrap binary operators.
BreakBeforeBinaryOperators: NonAssignment
# The brace breaking style to use.
BreakBeforeBraces: Allman
# The inheritance list style to use.
BreakInheritanceList: BeforeColon
# If true, ternary operators will be placed after line breaks.
BreakBeforeTernaryOperators: true
# The break constructor initializers style to use.
BreakConstructorInitializers: BeforeColon
# Allow breaking string literals when formatting.
BreakStringLiterals: true
# The column limit.
ColumnLimit: 80
# A regular expression that describes comments with special meaning, which
# should not be split into lines or otherwise changed.
CommentPragmas: '^ IWYU pragma:'
# If true, consecutive namespace declarations will be on the same line. If
# false, each namespace is declared on a new line.
CompactNamespaces: false
# The number of characters to use for indentation of constructor initializer
# lists as well as inheritance lists.
ConstructorInitializerIndentWidth: 4
# Indent width for line continuations.
ContinuationIndentWidth: 4
# If true, format braced lists as best suited for C++11 braced lists.
Cpp11BracedListStyle: true
# Analyze the formatted file for the most used line ending (\r\n or \n).
# UseCRLF is only used as a fallback if none can be derived.
DeriveLineEnding: true
# If true, analyze the formatted file for the most common alignment of & and *.
# Pointer and reference alignment styles are going to be updated according to
# the preferences found in the file. PointerAlignment is then used only as
# fallback.
DerivePointerAlignment: false
# Disables formatting completely.
DisableFormat: false
# If true, clang-format detects whether function calls and definitions are
# formatted with one parameter per line.
ExperimentalAutoDetectBinPacking: false
# If true, clang-format adds missing namespace end comments for short namespaces
# and fixes invalid existing ones. Short ones are controlled by
# “ShortNamespaceLines”.
FixNamespaceComments: true
# A vector of macros that should be interpreted as foreach loops instead of as
# function calls.
ForEachMacros:
- foreach
- Q_FOREACH
- BOOST_FOREACH
# Dependent on the value, multiple #include blocks can be sorted as one and
# divided based on category.
IncludeBlocks: Preserve
# Regular expressions denoting the different #include categories used for
# ordering #includes.
IncludeCategories:
- Regex: '^"(llvm|llvm-c|clang|clang-c)/'
Priority: 2
SortPriority: 0
- Regex: '^(<|"(gtest|gmock|isl|json)/)'
Priority: 3
SortPriority: 0
- Regex: '.*'
Priority: 1
SortPriority: 0
# Specify a regular expression of suffixes that are allowed in the
# file-to-main-include mapping.
IncludeIsMainRegex: '(Test)?$'
# Specify a regular expression for files being formatted that are allowed to be
# considered “main” in the file-to-main-include mapping.
IncludeIsMainSourceRegex: ''
# Indent case labels one level from the switch statement.
IndentCaseLabels: false
# Indent goto labels.
IndentGotoLabels: true
# The preprocessor directive indenting style to use.
IndentPPDirectives: None
# The number of columns to use for indentation.
IndentWidth: 4
# Indent if a function definition or declaration is wrapped after the type.
IndentWrappedFunctionNames: false
# If true, the empty line at the start of blocks is kept.
KeepEmptyLinesAtTheStartOfBlocks: true
# A regular expression matching macros that start a block.
MacroBlockBegin: ''
# A regular expression matching macros that end a block.
MacroBlockEnd: ''
# The maximum number of consecutive empty lines to keep.
MaxEmptyLinesToKeep: 1
# The indentation used for namespaces.
NamespaceIndentation: None
# Controls bin-packing Objective-C protocol conformance list items into as few
# lines as possible when they go over ColumnLimit.
ObjCBinPackProtocolList: Auto
# The number of characters to use for indentation of ObjC blocks.
ObjCBlockIndentWidth: 4
# Add a space after @property in Objective-C, i.e. use @property (readonly)
# instead of @property(readonly).
ObjCSpaceAfterProperty: false
# Add a space in front of an Objective-C protocol list, i.e. use Foo <Protocol>
# instead of Foo<Protocol>.
ObjCSpaceBeforeProtocolList: true
# The penalty for breaking around an assignment operator.
PenaltyBreakAssignment: 2
# The penalty for breaking a function call after call(.
PenaltyBreakBeforeFirstCallParameter: 1000
# The penalty for each line break introduced inside a comment.
PenaltyBreakComment: 300
# The penalty for breaking before the first <<.
PenaltyBreakFirstLessLess: 120
# The penalty for each line break introduced inside a string literal.
PenaltyBreakString: 1000
# The penalty for breaking after template declaration.
PenaltyBreakTemplateDeclaration: 10
# The penalty for each character outside of the column limit.
PenaltyExcessCharacter: 1000000
# Penalty for putting the return type of a function onto its own line.
PenaltyReturnTypeOnItsOwnLine: 60
# Pointer and reference alignment style.
PointerAlignment: Left
# If true, clang-format will attempt to re-flow comments.
ReflowComments: true
# Controls if and how clang-format will sort #includes. If Never, includes are
# never sorted. If CaseInsensitive, includes are sorted in an ASCIIbetical or
# case insensitive fashion. If CaseSensitive, includes are sorted in an
# alphabetical or case sensitive fashion.
SortIncludes: true
# If true, clang-format will sort using declarations.
SortUsingDeclarations: true
# If true, a space is inserted after C style casts.
SpaceAfterCStyleCast: false
# If true, a space is inserted after the logical not operator (!).
SpaceAfterLogicalNot: false
# If true, a space will be inserted after the ‘template’ keyword.
SpaceAfterTemplateKeyword: true
# If false, spaces will be removed before assignment operators.
SpaceBeforeAssignmentOperators: true
# If true, a space will be inserted before a C++11 braced list used to
# initialize an object (after the preceding identifier or type).
SpaceBeforeCpp11BracedList: false
# If false, spaces will be removed before constructor initializer colon.
SpaceBeforeCtorInitializerColon: true
# If false, spaces will be removed before inheritance colon.
SpaceBeforeInheritanceColon: true
# Defines in which cases to put a space before opening parentheses.
SpaceBeforeParens: ControlStatements
# If false, spaces will be removed before range-based for loop colon.
SpaceBeforeRangeBasedForLoopColon: true
# If true, spaces will be inserted into {}.
SpaceInEmptyBlock: false
# If true, spaces may be inserted into ().
SpaceInEmptyParentheses: false
# The number of spaces before trailing line comments (// - comments).
SpacesBeforeTrailingComments: 1
# The SpacesInAnglesStyle to use for template argument lists.
SpacesInAngles: false
# If true, spaces will be inserted around if/for/switch/while conditions.
SpacesInConditionalStatement: false
# If true, spaces are inserted inside container literals
# (e.g. ObjC and Javascript array and dict literals).
SpacesInContainerLiterals: true
# If true, spaces may be inserted into C style casts.
SpacesInCStyleCastParentheses: false
# If true, spaces will be inserted after ( and before ).
SpacesInParentheses: false
# If true, spaces will be inserted after [ and before ]. Lambdas without
# arguments or unspecified size array declarations will not be affected.
SpacesInSquareBrackets: false
# If true, spaces will be before [. Lambdas will not be affected. Only the
# first [ will get a space added.
SpaceBeforeSquareBrackets: false
# Parse and format C++ constructs compatible with this standard.
Standard: Latest
# A vector of macros that should be interpreted as complete statements.
StatementMacros:
- Q_UNUSED
- QT_REQUIRE_VERSION
# The number of columns used for tab stops.
TabWidth: 4
# Use \r\n instead of \n for line breaks. Also used as fallback if
# DeriveLineEnding is true.
UseCRLF: false
# The way to use tab characters in the resulting file.
UseTab: Never
...