-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy path.clang-format
More file actions
261 lines (206 loc) · 8.68 KB
/
.clang-format
File metadata and controls
261 lines (206 loc) · 8.68 KB
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
# See docs/internal/CodingStyleC.rst or http://donny/docs/CodingStyleC.html for
# details.
#
# Note that lots of options now have symbolic names, not just true/false, but
# some were added quite recently.
BasedOnStyle: Mozilla
# Extra indent/outdent for C++ access modifiers, like "public:".
# -4 keeps it aligned with the "class"/"struct" keyword.
AccessModifierOffset: -4
# Align continued lines with the opening parenthesis.
AlignAfterOpenBracket: true
# Whether to align assignments on consecutive lines like this:
# const char *my_name = "Marco";
# size_t len = strlen(my_name);
AlignConsecutiveAssignments: false
# How to align the "\" for defines covering multiple lines.
# If "Left" or "true" they are all aligned, but as left as possible.
# If "Right" or "false" they are aligned to the right of the file by adding a
# lot of spaces.
# If "DontAlign" (only available in new clang versions, no alignment is done).
AlignEscapedNewlinesLeft: true
# Whether to align operands of a single expression that needs to be split over
# multiple lines.
AlignOperands: true
# Whether to align traling comments across multiple lines.
# For instance, if "true":
# int foo = bar; // Hello world.
# int a; // Ciao mondo!
AlignTrailingComments: true
# Allow putting all parameters of a function declaration onto a separate line,
# even if BinPackParameters is "false".
AllowAllParametersOfDeclarationOnNextLine: false
# Whether to allow short statements (like "if (a) { return 42; }") on a single
# line. We only allow ifs.
AllowShortBlocksOnASingleLine: false
AllowShortCaseLabelsOnASingleLine: false
AllowShortFunctionsOnASingleLine: InlineOnly
AllowShortIfStatementsOnASingleLine: true
AllowShortLoopsOnASingleLine: false
# New line after the return type in a function definition (not declaration!).
AlwaysBreakAfterReturnType: TopLevelDefinitions
# To make things more consistent, break before a multiline string.
AlwaysBreakBeforeMultilineStrings: true
# Like AlwaysBreakAfterReturnType but for "template<...>".
AlwaysBreakTemplateDeclarations: false
# If "false", function arguments are fit all on a single line and, if not
# possible, split with only one argument per line.
# If ColumnLimit is 0, then setting this to "true" means that developers need
# to break lines manually where they want to.
BinPackArguments: true
# Like BinPackArguments but for parameters.
BinPackParameters: true
# How to break lines around "&&", "||", etc.
# "None" breaks after the operators.
BreakBeforeBinaryOperators: None
# Where to put braces.
# "Allman" means that a new line is always added before braces, we want
# something similar but not identical (due to "AfterExternBlock: false") so we
# need to use "Custom".
BreakBeforeBraces: Custom
BraceWrapping:
AfterControlStatement: true
AfterEnum: true
AfterExternBlock: false # "extern C {" on a single line.
AfterFunction: true
AfterNamespace: true
AfterObjCDeclaration: true
AfterClass: true
AfterStruct: true
AfterUnion: true
AfterCaseLabel: true
BeforeCatch: true
BeforeElse: true
IndentBraces: false # Don't indent braces themselves.
SplitEmptyFunction: true
SplitEmptyNamespace: true
SplitEmptyRecord: true
# How to indent long ternary operators.
# If "true"
# veryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryLongDescription
# ? firstValue
# : secondValueVeryVeryVeryVeryLong;
# If "false":
# veryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryLongDescription ?
# firstValue :
# secondValueVeryVeryVeryVeryLong;
BreakBeforeTernaryOperators: true
# How to align commas in C++ constructors.
BreakConstructorInitializers: AfterColon
# Maximum line width.
ColumnLimit: 0
# Comments which a special magic meaning which should not be split.
CommentPragmas: '^ IWYU pragma:'
# Put every C++ initializer on a separate line if they don't all fit on a
# single one.
ConstructorInitializerAllOnOneLineOrOnePerLine: true
# How much indentation to use for C++ initializers.
ConstructorInitializerIndentWidth: 8
# How much indentation to use for continued lines (note that functions are
# also controlled by AlignAfterOpenBracket).
ContinuationIndentWidth: 8
# How to align C++11-style braced lists.
# This also affects how C initializers like "int a[] = { b, c, d }" are
# treated. Among other things, "false" adds spaces between braces and content.
Cpp11BracedListStyle: false
# Whether PointerAlignment should be detected instead of using a fixed setting.
DerivePointerAlignment: false
# Whether to disable formatting completely.
DisableFormat: false
# Macros which implement a "for each"-like statement. They will be treated like
# "for"s so the body will be indented, but also a space will be added before the
# parenthesis.
ForEachMacros: ['array_FOREACH', 'array_countable_FOREACH', 'array_index_FOREACH', 'bits_FOREACH', 'breakpoint_FOREACH', 'child_mmaps_FOREACH', 'debug_sysinfo_FOREACH', 'defsigs_FOREACH', 'event_FOREACH', 'hash_table_u64_FOREACH', 'large_bitmask_FOREACH', 'list_FOREACH', 'mmap_FOREACH', 'mmap_FOREACH_IN_RANGE', 'mmap_FOREACH_IN_RANGE_SAFE', 'mmap_FOREACH_IN_SPAN', 'mmap_FOREACH_IN_SPAN_SAFE', 'mmap_FOREACH_SAFE', 'nursery_FOREACH', 'ordered_map_FOREACH', 'path_list_FOREACH', 'proc_tids_breakpoints_FOREACH', 'proc_tids_breakpoints_FOREACH_REVERSE', 'proc_tids_result_FOREACH', 'proc_tids_result_FOREACH_REVERSE', 'proc_tids_thread_FOREACH', 'RB_FOREACH', 'RB_FOREACH_REVERSE', 'RB_FOREACH_REVERSE_SAFE', 'RB_FOREACH_SAFE', 'rtid_states_FOREACH', 'rtid_states_FOREACH_CONST', 'signal_FOREACH', 'SPLAY_FOREACH', 'vector_FOREACH', 'vector_FOREACH_REVERSE']
IncludeBlocks: Regroup
IncludeCategories:
- Regex: '^"\./'
Priority: 1
- Regex: '^"apps/'
Priority: 2
- Regex: '^"config/'
Priority: 3
- Regex: '^"engine_api/'
Priority: 4
- Regex: '^"engine_impl/'
Priority: 5
- Regex: '^"experimental/'
Priority: 6
- Regex: '^"keyfile/'
Priority: 7
- Regex: '^"recording/'
Priority: 8
- Regex: '^"util/'
Priority: 9
# 3rd party code:
- Regex: '^"3rd_party/'
Priority: 10
# C system includes:
- Regex: '^<.*\.h>'
Priority: 11
# C ++ system includes:
- Regex: '^<.*'
Priority: 12
- Regex: '^"(\.\./)+'
Priority: 13
- Regex: '.*'
Priority: 1000 # These shouldn't happen!
# Whether "case" labels should be indented.
IndentCaseLabels: true
# How to indent pre-processor directives.
IndentPPDirectives: None
# How many spaces for indentation.
IndentWidth: 4
# Indent after a function declaration is split on multiple lines.
IndentWrappedFunctionNames: false
# Whether to keep empty lines at the start of a block.
KeepEmptyLinesAtTheStartOfBlocks: true
# Language to use. "Cpp" also covers C, not only C++.
Language: Cpp
# The maximum number of consecutive empty lines to keep.
MaxEmptyLinesToKeep: 1
# How to indent inside C++ namespaces.
NamespaceIndentation: None
# Objective-C stuff
ObjCBlockIndentWidth: 3
ObjCSpaceAfterProperty: true
ObjCSpaceBeforeProtocolList: false
# Penalties to calculate what to do when all the options are a bit ugly...
PenaltyBreakBeforeFirstCallParameter: 100
PenaltyBreakComment: 300
PenaltyBreakFirstLessLess: 120
PenaltyBreakString: 1000
PenaltyExcessCharacter: 1000000
PenaltyReturnTypeOnItsOwnLine: 200
# Where to put "*"s for pointers.
PointerAlignment: Right
# Put includes into a sensible order, as described by IncludeCategories.
SortIncludes: true
# Space after a C-style cast (i.e. "a = (int) b").
SpaceAfterCStyleCast: false
# Space before assignments.
SpaceBeforeAssignmentOperators: true
# Space before parenthesis only for "if", "for", etc. and not for calls.
SpaceBeforeParens: ControlStatements
# Don't add a space inside parenthesis if empty.
SpaceInEmptyParentheses: false
# How many spaces before a trailig "//" comment.
# This doesn't apply to "/* ... */" comments.
SpacesBeforeTrailingComments: 1
# Whether to add spaces inside "<" and ">" for C++ templates.
SpacesInAngles: false
# Whether to add spaces inside C-style casts.
SpacesInCStyleCastParentheses: false
# Spaces inside contained literals (for Objective-C and Javascript).
SpacesInContainerLiterals: true
# Whether to add spaces inside parenthesis.
SpacesInParentheses: false
# Whether to add spaces inside square brackets.
SpacesInSquareBrackets: false
# Which C++ standard to use.
# We support C++14 in product code (see docs/internal/CodingStyleC) but
# clang-format does not have a Cpp14 setting, so we use Cpp11.
Standard: Cpp11
# How wide should a tab be?
TabWidth: 4
# Never ever use tabs! They are evil!
UseTab: Never