-
Notifications
You must be signed in to change notification settings - Fork 152
/
.clang-format
394 lines (393 loc) · 8.06 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
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
---
Language: Cpp
# BasedOnStyle: Microsoft
AccessModifierOffset: -2
AlignAfterOpenBracket: Align
# someLongFunction(argument1,
# argument2);
#
AlignConsecutiveMacros: true
# #define SHORT_NAME 42
# #define LONGER_NAME 0x007f
# #define EVEN_LONGER_NAME (2)
#
AlignConsecutiveAssignments: true
# int aaaa = 12;
# int b = 23;
# int ccc = 23;
#
AlignConsecutiveDeclarations: false
#
AlignEscapedNewlines: Left
# #define A \
# int aaaa; \
# int b; \
# int dddddddddd;
#
AlignOperands: true
# int aaa = bbbbbbbbbbbbbbb +
# ccccccccccccccc;
#
AlignTrailingComments: true
# int a; // My comment a
# int b = 2; // comment b
#
AllowAllArgumentsOnNextLine: true
# callFunction(
# a, b, c, d);
#
AllowAllConstructorInitializersOnNextLine: true
# MyClass::MyClass() :
# member0(0),
# member1(2) {}
#
AllowAllParametersOfDeclarationOnNextLine: true
# void myFunction(
# int a, int b, int c, int d, int e);
#
AllowShortBlocksOnASingleLine: true
# if (a) { return; }
#
AllowShortCaseLabelsOnASingleLine: false
# switch (a) {
# case 1: x = 1; break;
# case 2: return;
# }
#
AllowShortFunctionsOnASingleLine: All
# class Foo {
# void f() { foo(); }
# };
# void f() { bar(); }
#
AllowShortLambdasOnASingleLine: All
# auto lambda = [](int a) {}
# auto lambda2 = [](int a) { return a; };
#
# Not found in clang 9.0.0
# AllowShortIfStatementsOnASingleLine: All
#
AllowShortLoopsOnASingleLine: true
# while (true) continue;
#
# Depcrated according to clang 9.0.0
# AlwaysBreakAfterDefinitionReturnType: None
#
AlwaysBreakAfterReturnType: None
# class A {
# int f() { return 0; };
# };
# int f();
# int f() { return 1; }
#
AlwaysBreakBeforeMultilineStrings: true
# aaaa =
# "bbbb"
# "cccc";
#
AlwaysBreakTemplateDeclarations: MultiLine
# template <typename T> T foo() {
# }
# template <typename T>
# T foo(int aaaaaaaaaaaaaaaaaaaaa,
# int bbbbbbbbbbbbbbbbbbbbb) {
# }
#
BinPackArguments: false
# void f() {
# f(aaaaaaaaaaaaaaaaaaaa,
# aaaaaaaaaaaaaaaaaaaa,
# aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa);
# }
#
BinPackParameters: false
# void f(int aaaaaaaaaaaaaaaaaaaa,
# int aaaaaaaaaaaaaaaaaaaa,
# int aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa) {}
#
BraceWrapping:
AfterCaseLabel: false
AfterClass: false
# class foo
# {
# int x;
# };
AfterControlStatement: false
# if (foo()) {
# } else {
# }
# for (int i = 0; i < 10; ++i) {
#}
AfterEnum: false
# enum X : int { B };
AfterFunction: true
# void foo()
# {
# bar();
# bar2();
# }
AfterNamespace: true
# namespace
# {
# int foo();
# int bar();
# }
AfterObjCDeclaration: true
AfterStruct: true
# struct foo
# {
# int x;
# };
AfterUnion: true
# union foo
# {
# int x;
# }
AfterExternBlock: true
# extern "C"
# {
# int foo();
# }
BeforeCatch: true
# try {
# foo();
# }
# catch () {
# }
BeforeElse: true
# if (foo()) {
# }
# else {
# }
IndentBraces: false
SplitEmptyFunction: false
SplitEmptyRecord: false
SplitEmptyNamespace: false
BreakBeforeBinaryOperators: None
# LooooooooooongType loooooooooooooooooooooongVariable =
# someLooooooooooooooooongFunction();
#
# bool value = aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa +
# aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa ==
# aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa &&
# aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa >
# ccccccccccccccccccccccccccccccccccccccccc;
#
BreakBeforeBraces: Stroustrup
# try {
# foo();
# }
# catch () {
# }
# void foo() { bar(); }
# class foo {
# };
# if (foo()) {
# }
# else {
# }
#
# enum X : int { A, B };
#
# Not found in clang 9.0.0
# BreakBeforeInheritanceComma: false
BreakInheritanceList: BeforeComma
# class Foo
# : Base1
# , Base2
# {};
BreakBeforeTernaryOperators: true
# veryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryLongDescription
# ? firstValue
# : SecondValueVeryVeryVeryVeryLong;
#
# Not found in clang 9.0.0
# BreakConstructorInitializersBeforeComma: false
BreakConstructorInitializers: BeforeComma
# Constructor()
# : initializer1()
# , initializer2()
#
# Not found in clang 9.0.0
# BreakAfterJavaFieldAnnotations: false
#
BreakStringLiterals: true
ColumnLimit: 80
# the column limit is based on GNU, Google and Mozilla coding style
# for 1080p two split windows can be shown side by side with font size 10
#
CommentPragmas: '^ IWYU pragma:'
CompactNamespaces: false
# namespace Foo {
# namespace Bar {
# }
# }
#
ConstructorInitializerAllOnOneLineOrOnePerLine: false
# SomeClass::Constructor()
# : aaaaaaaa(aaaaaaaa), aaaaaaaa(aaaaaaaa),
# aaaaaaaa(aaaaaaaaaaaaaaaaaaaaaaaaa) {
# return 0;
# }
#
ConstructorInitializerIndentWidth: 2
ContinuationIndentWidth: 2
# int i = // VeryVeryVeryVeryVeryLongComment
# longFunction( // Again a long comment
# arg);
#
Cpp11BracedListStyle: true
DerivePointerAlignment: false
DisableFormat: false
ExperimentalAutoDetectBinPacking: false
FixNamespaceComments: true
# namespace a {
# foo();
# } // namespace a
#
ForEachMacros:
- foreach
- Q_FOREACH
- BOOST_FOREACH
IncludeBlocks: Regroup
# #include "b.h" into #include "a.h"
# #include "b.h"
# #include <lib/main.h>
# #include "a.h" #include <lib/main.h>
#
IncludeCategories:
- Regex: '^"(llvm|llvm-c|clang|clang-c)/'
Priority: 2
- Regex: '^(<|"(gtest|gmock|isl|json)/)'
Priority: 3
- Regex: '.*'
Priority: 1
IncludeIsMainRegex: '(Test)?$'
IndentCaseLabels: false
IndentPPDirectives: None
# #if FOO
# #if BAR
# #include <foo>
# #endif
# #endif
#
IndentWidth: 2
IndentWrappedFunctionNames: false
# LoooooooooooooooooooooooooooooooooooooooongReturnType
# LoooooooooooooooooooooooooooooooongFunctionDeclaration();
JavaScriptQuotes: Leave
JavaScriptWrapImports: true
KeepEmptyLinesAtTheStartOfBlocks: false
# if (foo) {
# bar();
# }
#
MacroBlockBegin: ''
MacroBlockEnd: ''
MaxEmptyLinesToKeep: 2
# Zero of consecutive empty lines to keep.
#
NamespaceIndentation: None
# namespace out {
# int i;
# namespace in {
# int i;
# }
# }
#
ObjCBinPackProtocolList: Auto
ObjCBlockIndentWidth: 2
ObjCSpaceAfterProperty: false
ObjCSpaceBeforeProtocolList: true
PenaltyBreakAssignment: 2
PenaltyBreakBeforeFirstCallParameter: 19
PenaltyBreakComment: 300
PenaltyBreakFirstLessLess: 120
PenaltyBreakString: 1000
PenaltyBreakTemplateDeclaration: 10
PenaltyExcessCharacter: 1000000
PenaltyReturnTypeOnItsOwnLine: 1000
PointerAlignment: Left
# int* a;
#
ReflowComments: true
# // veryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryLongComment with plenty of
# // information
# /* second veryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryLongComment with plenty of
# * information */
#
SortIncludes: false
# #include "b.h"
# #include "a.h"
#
SortUsingDeclarations: false
# using std::cout;
# using std::cin;
#
SpaceAfterCStyleCast: false
# (int)i;
#
SpaceAfterLogicalNot: false
# !someExpression();
#
SpaceAfterTemplateKeyword: true
# template <int> void foo();
#
SpaceBeforeAssignmentOperators: true
# int a = 5;
# a += 42;
#
SpaceBeforeCpp11BracedList: false
# Foo foo{ bar };
# Foo{};
# vector<int>{ 1, 2, 3 };
# new int[3]{ 1, 2, 3 };
#
SpaceBeforeCtorInitializerColon: true
# Foo::Foo() : a(a) {}
#
SpaceBeforeInheritanceColon: true
# class Foo : Bar {}
#
SpaceBeforeParens: ControlStatements
# void f() {
# if (true) {
# f();
# }
# }
#
SpaceBeforeRangeBasedForLoopColon: false
# for(auto v: values) {}
#
SpaceInEmptyParentheses: false
SpacesBeforeTrailingComments: 3
# void f() {
# if (true) { // foo1
# f(); // bar
# } // foo
# }
#
SpacesInAngles: false
# static_cast<int>(arg);
# std::function<void(int)> fct;
#
SpacesInContainerLiterals: false
# var arr = [1, 2, 3];
# f({a: 1, b: 2, c: 3});
SpacesInCStyleCastParentheses: false
# x = (int32)y
#
SpacesInParentheses: false
# t f(Deleted &) & = delete;
#
SpacesInSquareBrackets: false
# int a[5];
#
Standard: Cpp11
# In Clang 10.0.0: Cpp11, Cpp14, Cpp17 and Cpp20
StatementMacros:
- Q_UNUSED
- QT_REQUIRE_VERSION
TabWidth: 2
UseTab: Never
...