-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path.clang-format
executable file
·278 lines (218 loc) · 5.45 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
# The examples for the settings effects are copied from clang-format style options documentation
# https://clang.llvm.org/docs/ClangFormatStyleOptions.html
---
# Use these settings for C/C++ files
Language: Cpp
# Copy all settings that are not overwritten here from the Google style
BasedOnStyle: Google
# The extra indent or outdent of access modifiers, e.g. public:
AccessModifierOffset: -2
# set the standard indent to 2
IndentWidth: 2
# someLongFunction(argument1,
# argument2);
AlignAfterOpenBracket: AlwaysBreak
# int aaaa = 12;
# int b = 23;
# int ccc = 23;
AlignConsecutiveAssignments: true
# NOT!
# int aaaa = 12;
# float b = 23;
# std::string ccc = 23;
AlignConsecutiveDeclarations: false
# #define A \
# int aaaa; \
# int b; \
AlignEscapedNewlinesLeft: true
# int aaa = bbbbbbbbbbbbbbb +
# ccccccccccccccc;
AlignOperands: true
# int a; // My comment a
# int b = 2; // comment b
AlignTrailingComments: true
# void myFunction(int a,
# int b,
# int c);
AllowAllParametersOfDeclarationOnNextLine: false
# NOT!
# if (a) { return; }
AllowShortBlocksOnASingleLine: false
# NOT!
# case 1: x = 1; break;
AllowShortCaseLabelsOnASingleLine: false
# Never merge functions into a single line
AllowShortFunctionsOnASingleLine: None
# NOT!
# if (a) return;
AllowShortIfStatementsOnASingleLine: false
# NOT!
# while (true) continue;
AllowShortLoopsOnASingleLine: false
# class A {
# int f() {
# return 0;
# };
# };
# int f();
# int f() { return 1; }
AlwaysBreakAfterReturnType: None
# aaaa =
# "bbbb"
# "cccc";
AlwaysBreakBeforeMultilineStrings: true
# template <typename T>
# class C {
# };
AlwaysBreakTemplateDeclarations: true
# void f()
# {
# f(aaaaaaaaaaaaaaaaaaaa, aaaaaaaaaaaaaaaaaaaa,
# aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa);
# }
BinPackArguments: true
# void f(int aaaaaaaaaaaaaaaaaaaa, int aaaaaaaaaaaaaaaaaaaa,
# int aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa) {}
BinPackParameters: true
# Customize brace breaking/wrapping
BreakBeforeBraces: Custom
BraceWrapping:
# class foo {
# };
AfterClass: false
# if (foo()) {
# }
# else {
# }
AfterControlStatement: false
# enum X : int {
# B
# };
AfterEnum: false
# void foo() {
# bar();
# bar2();
# }
AfterFunction: false
# namespace {
# int foo();
# int bar();
# }
AfterNamespace: false
# struct foo {
# int x;
# };
AfterStruct: false
# union foo {
# int x;
# };
AfterUnion: false
# try {
# foo();
# }
# catch () {
# }
BeforeCatch: false
# if (foo()) {
# }
# else {
# }
BeforeElse: true
# Do not indent the braces themselves
IndentBraces: false
# LooooooooooongType loooooooooooooooooooooongVariable =
# someLooooooooooooooooongFunction();
#
# bool value = aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
# + aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
# == aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
# && aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
# > ccccccccccccccccccccccccccccccccccccccccc;
BreakBeforeBinaryOperators: NonAssignment
# veryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryLongDescription
# ? firstValue
# : SecondValueVeryVeryVeryVeryLong;
BreakBeforeTernaryOperators: true
# Constructor()
# : initializer1()
# , initializer2()
BreakConstructorInitializers: BeforeComma
# Allow breaking string literals when formatting
BreakStringLiterals: true
# The column limit
ColumnLimit: 120
# If the initializers do not fit into one line, put every one on its own
ConstructorInitializerAllOnOneLineOrOnePerLine: true
# The number of characters to use for indentation of constructor initializer lists
ConstructorInitializerIndentWidth: 2
# int i = // VeryVeryVeryVeryVeryLongComment
# longFunction( // Again a long comment
# arg);
ContinuationIndentWidth: 2
# vector<int> x{1, 2, 3, 4};
# vector<T> x{{}, {}, {}, {}};
# f(MyMap[{composite, key}]);
# new int[3]{1, 2, 3};
Cpp11BracedListStyle: true
# Do not automatically derive the pointer alignment, use my setting all the time
DerivePointerAlignment: false
# Do not disable formatting at all
DisableFormat: false
# switch (fool) {
# case 1:
# bar();
# break;
# default:
# plop();
# }
IndentCaseLabels: false
# LoooooooooooooooooooooooooooooooooooooooongReturnType
# LoooooooooooooooooooooooooooooooongFunctionDeclaration();
IndentWrappedFunctionNames: true
# NOT!
# if (foo)
# {
#
# bar();
# }
KeepEmptyLinesAtTheStartOfBlocks: false
# int* a;
PointerAlignment: Left
# Let clang-format break long comments
ReflowComments: true
# I want to keep the includes in my order
SortIncludes: false
# (int) i;
SpaceAfterCStyleCast: true
# int a = 5;
# a += 42;
SpaceBeforeAssignmentOperators: true
# void f() {
# if (true) {
# f();
# }
# }
SpaceBeforeParens: ControlStatements
# f();
SpaceInEmptyParentheses: false
# void f() {
# if (true) {
# f(); // bar
# }
# }
SpacesBeforeTrailingComments: 2
# static_cast<int>(arg);
SpacesInAngles: false
# x = (int32) y;
SpacesInCStyleCastParentheses: false
# t f(Deleted&) & = delete;
SpacesInParentheses: false
# int a[5];
SpacesInSquareBrackets: false
# Use features of C++11, C++14 and C++1z
Standard: Cpp11
# The number of columns used for tab stops
TabWidth: 2
# Never use tab
UseTab: Never
...