-
Notifications
You must be signed in to change notification settings - Fork 24
/
.clang-format
358 lines (290 loc) · 12.2 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
352
353
354
355
356
357
358
# TdS Auto clang-format configuration file (clang-format 6.0)
#
# Use:
# - Install clang-format-6.0
# >sudo apt-get install clang-format-6.0
# (or sudo aptitude install, ...)
# - Put the .clang-format file in the working directory
# - For avoiding problems: put a "default" .clang-format configuration file in
# the home repertory Either this one or a simple one with at least the
# "Langage" and "BasedOnStyle" properties
# - Execute clang-format
# >clang-format-6.0 -i -style=file <fileName1>.cpp
# If several files:
# >clang-format-6.0 -i -style=file <fileName1>.cpp <fileName2>.hpp ...
# Note: the -i option tells clang-format to modify the file rather than
# creating a new one
#
# For formatting a lot of files:
# >find . -name "*hpp" -exec clang-format-6.0 -i -style=file {} \;
# >find . -name "*cpp" -exec clang-format-6.0 -i -style=file {} \;
# Format all the files in the current folder (including subfolders)
# For immunizing a section against clang-format, encapsulate it with the
# the comments "clang-format off" and "clang-format on"
# // clang-format off
# ...
# // clang-format on
# For more information on the available properties and their possible value
# http://releases.llvm.org/6.0.1/tools/clang/docs/ClangFormatStyleOptions.html
# Language
Language: Cpp
# All values are set by default according to this convention
# These value are then overriden with the ones specified in this file
# -> Here we are closer to mozilla and chromium
BasedOnStyle: Chromium
# The extra indent or outdent of access modifiers, e.g. public:
# -> Set to -(the indentation) so that these modifiers are not indented
AccessModifierOffset: -4
# Alignement of inputs inside a round brackets (parentheses), angle brackets and
# square brackets
# when there is not enough space on a same line
# -> Align: stack them, one per line, vertically aligned with the first
# character of the first input
# someLongFunction(argument1,
# argument2)
AlignAfterOpenBracket: Align
# If true, aligns consecutive assignments
# -> false: since it can be strange when types with different length are near
# each other
AlignConsecutiveAssignments: false
# If true, aligns consecutive declarations
# -> false: since it can be strange when types with different length are near
# each other
AlignConsecutiveDeclarations: false
# Options for aligning backslashes in escaped newlines
# -> Align: escaped newlines as far left as possible
# #define A \
# int aaaa; \
# int b; \
# int dddddddddd;
AlignEscapedNewlines: Left
# If true, horizontally align operands of binary and ternary expressions
# -> true: aligns operands of a single expression that needs to be split over
# multiple lines
# int aaa = bbbbbbbbbbbbbbb +
# ccccccccccccccc;
AlignOperands: true
# If true, aligns trailing comments
# -> true: this is cleaner
# int a // Comment
# Vector3f b // Comment
# double* c // Comment
AlignTrailingComments: true
# 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.
# -> false: Not allowed, split in one per line
# void myFunction(int a,
# int b,
# int c,
# int d,
# int e);
AllowAllParametersOfDeclarationOnNextLine: false
# If true, allows contracting simple braced statements to a single line
# -> false: Not allowed for the sake of absolute clarity
AllowShortBlocksOnASingleLine: false
# If true, short case labels will be contracted to a single line
# -> false: Not allowed, only one instruction per line
AllowShortCaseLabelsOnASingleLine: false
# If true int f() { return 0; } can be put on a single line
# -> false: Not allowed, skip a line after a brace
AllowShortFunctionsOnASingleLine: false
# If true, if (a) return; can be put on a single line
# -> false: Not allowed
AllowShortIfStatementsOnASingleLine: false
# If true, while (true) continue; can be put on a single line
# -> false: Not allowed
AllowShortLoopsOnASingleLine: false
# DEPRECATED
# The function definition return type breaking style to use
# -> None: Break after return type automatically
AlwaysBreakAfterDefinitionReturnType: None
# The function declaration return type breaking style to use
# -> None: Break after return type automatically
AlwaysBreakAfterReturnType: None
# If true, always break before multiline string literals
# -> false
AlwaysBreakBeforeMultilineStrings: false
# If true, always break after the template<...> of a template declaration
# -> true: faster identification of templated objects
# template <typename T>
# class C {};
AlwaysBreakTemplateDeclarations: true
# If false, a function call’s arguments will either be all on the same line or
# will have one line each
# -> false, can look messy otherwise
BinPackArguments: false
# If false, a function declaration’s or function definition’s parameters will
# either all be on the same line or will have one line each
# -> false, can look messy otherwise
BinPackParameters: false
# BraceWrapping: ignored since BreakBeforeBraces is not set to custom
# This field specifies how to treat each kind of braces when the property
# BreakBeforeBraces is set to custom
# In this file, BreakBeforeBraces is set to Allman which treats all the braces
# the same way: break before all braces
# See BreakBeforeBraces
# BreakAfterJavaFieldAnnotations: ignored for C++
# The way to wrap binary operators when expression are too long to hold on a
# single line
# -> All: Break before operators, so that they can easily be identified at the
# beginning of the line
#
# LooooooooooongType loooooooooooooooooooooongVariable
# = someLooooooooooooooooongFunction();
#
# bool value
# = aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
# + aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
# == aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
# && aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
# > ccccccccccccccccccccccccccccccccccccccccc;
BreakBeforeBinaryOperators: All
# The brace breaking style to use
# -> Allman: Always break before braces, longer but clearer files
BreakBeforeBraces: Allman
# If true, in the class inheritance expression clang-format will break
# before ":" and "," if there is multiple inheritance
# -> false: breaking is overkill here most of the time
BreakBeforeInheritanceComma: false
# If true, ternary operators will be placed after line breaks
# -> true: for consistency with BreakBeforeBinaryOperators
BreakBeforeTernaryOperators: true
# The constructor initializers style to use
# -> AfterColon: Break constructor initializers after the colon and commas
# because alone comma at the beginning of the line is ugly
BreakConstructorInitializers: AfterColon
# Allow breaking string literals when formatting
# -> true: clang format does it better than you
BreakStringLiterals: true
# Maximum number of characters per line
# -> 100: Historically 80 for C++, but quite deprecated today; it is dicutable
# but 100 seemed to be more adequat in our case
ColumnLimit: 100
# A regular expression that describes comments with special meaning, which
# should not be split into lines or otherwise changed
# -> default value
CommentPragmas: '^ IWYU pragma:'
# If true, consecutive namespace declarations will be on the same line. If
# false, each namespace is declared on a new line
# -> false: one line per namespace, ugly otherwise
CompactNamespaces: false
# If the constructor initializers don’t fit on a line, put each initializer on
# its own line
# -> true
ConstructorInitializerAllOnOneLineOrOnePerLine: true
# The number of characters to use for indentation of constructor initializer
# lists
# -> 1 to highlight the brace at the end of the initialization and emphasize
# that it is inside the constructor, but before any instruction
ConstructorInitializerIndentWidth: 1
# Indent width for line continuations
# -> 2: So that it is differenciable from other identations
ContinuationIndentWidth: 2
# If true, format braced lists as best suited for C++11 braced lists
# -> true
Cpp11BracedListStyle: 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
# -> false: allways use the convention specified in this file
DerivePointerAlignment: false
# Disables formatting completely
# -> false
DisableFormat: false
# If true, clang-format detects whether function calls and definitions are
# formatted with one parameter per line
# -> false: allways use the convention specified in this file
ExperimentalAutoDetectBinPacking: false
# A vector of macros that should be interpreted as foreach loops instead of as
# function calls.
# -> no macro
ForEachMacros: []
# If true, clang-format adds missing namespace end comments and fixes invalid
# existing ones
# -> true: add a lot of clarity to these endless braces at the end of a file
FixNamespaceComments: true
# Indent case labels one level from the switch statement
# -> false
IndentCaseLabels: false
# The preprocessor directive indenting style to use
# -> None: never indent preprocessor directives
IndentPPDirectives: None
# The number of columns to use for indentation
# -> 4: Good compromise between visible and limiting additional spaces
IndentWidth: 4
# Indent if a function definition or declaration is wrapped after the type
# -> true: to be clear on the fact that this is not another function declaration
IndentWrappedFunctionNames: true
# If true, the empty line at the start of blocks is kept
# -> false: this is useless
KeepEmptyLinesAtTheStartOfBlocks: false
# The maximum number of consecutive empty lines to keep
# -> 1: Use comments to differenciate important parts of a big portion of code
# (or split it into functions for instance) rather than a big block of
# empty lines
MaxEmptyLinesToKeep: 1
# The indentation used for namespaces
# -> None: Do not add an indentation level
NamespaceIndentation: None
# Pointer and reference alignment style
# -> Left: the type of a variable is at its left, and the * or the & are part of
# this type
PointerAlignment: Left
# If true, clang-format will attempt to re-flow comments
# -> true: because clang-format does it better than you
ReflowComments: true
# If true, clang-format will sort #includes
# -> false: see coding guidelines
SortIncludes: false
# If true, clang-format will sort using declarations
# -> false
SortUsingDeclarations: false
# If true, a space is inserted after C style casts
# -> false
SpaceAfterCStyleCast: false
# If true, a space will be inserted after the ‘template’ keyword
# -> false
SpaceAfterTemplateKeyword: false
# If false, spaces will be removed before assignment operators
# -> true
SpaceBeforeAssignmentOperators: true
# Defines in which cases to put a space before opening parentheses
# -> ControlStatements: Before if/while/for statements
SpaceBeforeParens: ControlStatements
# If true, spaces may be inserted into ()
# -> false
SpaceInEmptyParentheses: false
# The number of spaces before trailing line comments (// - comments)
# -> 1
SpacesBeforeTrailingComments: 1
# If true, spaces will be inserted after < and before > in template argument
# lists
# -> false
SpacesInAngles: false
# If true, spaces may be inserted into C style casts
# -> false
SpacesInCStyleCastParentheses: false
# If true, spaces are inserted inside container literals (e.g. ObjC and
# Javascript array and dict literals)
# -> false
SpacesInContainerLiterals: false
# If true, spaces will be inserted after ( and before )
# -> false
SpacesInParentheses: false
# If true, spaces will be inserted after [ and before ]. Lambdas or unspecified
# size array declarations will not be affected
# -> false
SpacesInSquareBrackets: false
# Format compatible with this standard, e.g. use A<A<int> > instead of A<A<int>>
# for LS_Cpp03
# Cpp11
Standard: Cpp11
# The number of columns used for tab stops
# Note: this property is not used since tabs are forbidden (see UseTab)
# -> 8
TabWidth: 8
# The way to use tab characters in the resulting file
# -> Never: Allways use spaces
UseTab: Never