-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path.clang-format
247 lines (188 loc) · 6.72 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
Language: C
Language: Cpp
# Aligns parameters contained within open brackets
# .e.g longFunction (argument1,
# argument2)
AlignAfterOpenBracket: Align
# Aligns the assignment operators
AlignConsecutiveAssignments: AcrossComments
# Aligns the variable names
AlignConsecutiveDeclarations: AcrossComments
# Aligns consecutive bitfields
AlignConsecutiveBitFields: AcrossComments
# Aligns macros
#define SHORT_NAME 42
#define LONGER_NAME 0x007f
#define EVEN_LONGER_NAME (2)
#define foo(x) (x * x)
#define bar(y, z) (y + z)
AlignConsecutiveMacros: AcrossComments
# Align "\" new-line characters as far left as possible
# define A \
# int aaaa; \
# int b; \
# int dddddddddd;
AlignEscapedNewlinesLeft: 'true'
# Aligns operands that need to be split over multiple lines
AlignOperands: 'true'
# Align comments
AlignTrailingComments: 'true'
# if function declaration doesn't fit on a line, put all params
# of function dec. onto next line. Overrides BinPackParameters option
# void myFunc(
# int a, int b, int c, int d, int e);
AllowAllParametersOfDeclarationOnNextLine: 'false'
# Allows braced statements to be on a single line
# e.g. if (eval) { return true; }
AllowShortBlocksOnASingleLine: 'true'
# only merge functions defined inside a class, including empty ones
# Other options include "empty" where onyl empty functions are inline
# "InlineOnly" which excludes empty functions and "All" which merges
# all functions fitting on a single line
AllowShortFunctionsOnASingleLine: Inline
# single line conditionals can be put on a single line
# if (a) operation;
# vs.
# if (a)
# operation;
AllowShortIfStatementsOnASingleLine: 'false'
# self-explanatory.
AllowShortCaseLabelsOnASingleLine: 'false'
# self-explanatory. for(;;) operation;
AllowShortLoopsOnASingleLine: 'true'
# break long strings into multiple lines and then align the strings
AlwaysBreakBeforeMultilineStrings: 'false'
# Forces the params and names following the template decl. to
# break into multiline
# e.g.
# template <typename T>
# T foo (int a, int b)
AlwaysBreakTemplateDeclarations: 'false'
# if false, a function call's arguments get their own lines
BinPackArguments: 'true'
# if false, a function declaration's args get their own lines
BinPackParameters: 'true'
# self explanatory
BitFieldColonSpacing: After
# forces the operator to be the end of line and the second monomial
# term to a new line
# e.g. val = a +
# b /
# c;
BreakBeforeBinaryOperators: None
# forces each operand to a new line
BreakBeforeTernaryOperators: 'true'
BreakBeforeBraces: Custom
BraceWrapping:
{
AfterCaseLabel: 'true'
AfterClass: 'true'
AfterControlStatement: 'true'
AfterEnum: 'true'
AfterFunction: 'true'
AfterNamespace: 'true'
AfterObjCDeclaration: 'true'
AfterStruct: 'true'
AfterUnion: 'true'
AfterExternBlock: 'false'
BeforeCatch: 'true'
BeforeElse: 'true'
IndentBraces: 'false'
SplitEmptyFunction: 'false'
SplitEmptyRecord: 'false'
SplitEmptyNamespace: 'false'
}
# true:
# const char* x = "veryVeryVeryVeryVeryVe"
# "ryVeryVeryVeryVeryVery"
# "VeryLongString";
BreakStringLiterals: 'true'
#ExperimentalAutoDetectBinPacking: true
# we don't believe in ColumnLimits here...everyone has infinitely wide screens
ColumnLimit: '0'
# stop clang from trying to format the special
# Cube-generated starting and ending comments
CommentPragmas: '^( #####(\#+))'
# Either fits all the constructor call args onto one line
# or each param gets their own line if they don't fit
ConstructorInitializerAllOnOneLineOrOnePerLine: 'true'
# number of char to use for indentation of contructor initializer lists
# class::construct() : \noOfChars a(a), \noOfChars b(b) {};
ConstructorInitializerIndentWidth: '2'
# indent width length for line continuations
# int i =
# \noOfChars function(
# 2*\noOfChars arg);
ContinuationIndentWidth: '4'
# Format braced lists as best suited for C++11 braced lists
# Important Differences (if 'true')
# - no spaces inside the braced lists
# - no line break before closing brace
# - indentation with the continuation indentation, not with block indent
Cpp11BracedListStyle: 'false'
# how to sort include blocks
IncludeBlocks: Preserve
# "case" keywords are indented from the "switch"
IndentCaseLabels: 'true'
# self-explanatory
IndentWidth: '4'
# indent if function def or declaration is wrapped after the type
# e.g.
# stupidlyLongReturnType
# stupidlyLongFunctionDeclaration();
IndentWrappedFunctionNames: 'true'
# preprocessor block indenting
IndentPPDirectives: AfterHash
# self-explanatory, apparently can't be used with bin packing
# InsertTrailingCommas: Wrapped
# empty line at start of new scope is kept
KeepEmptyLinesAtTheStartOfBlocks: 'false'
# how many empty lines to leave
MaxEmptyLinesToKeep: '2'
# Changed this. Made it C specific. Should also be right aligned.
# "Left" : Leave the pointer character in a variable declaration to the left (e.g. int* a)
# "Right" : Align pointer to right (e.g. int *a)
# "Middle" : Align pointer between type and var name (e.g. int * a)
PointerAlignment: Left
# how much to indent subsequent preprocessor blocks by
PPIndentWidth: '1'
# if "None", no namespaces are indented
# if "Inner", only inner namespaces are indented
# if "All", every new scope is indented (intuitive)
NamespaceIndentation: Inner
# splits long comments into multiline
ReflowComments: 'true'
# lists of the include headers in alphabetical order
SortIncludes: 'true'
# TODO: Enable me when clang-format has been updated to understand me
#SortUsingDeclarations: 'false'
# inserts a space between casts and the variables they're targeting
SpaceAfterCStyleCast: 'false'
# TODO: Enable me when clang-format has been updated to understand me
#SpaceAfterTemplateKeyword: 'false'
# self-explanatory
SpaceBeforeAssignmentOperators: 'true'
# "Never" : don't put a space before opening parantheses
# "ControlStatements" : only put space before parantheses belonging to ctrl statements
# "Always" : always put a space before opening params
SpaceBeforeParens: ControlStatements
# self-explanatory
SpaceInEmptyParentheses: 'false'
# number of spaces before c-style comments "//"
SpacesBeforeTrailingComments: '4'
# spaces inserted after < and before > in template argument lists
SpacesInAngles: 'false'
# Spaces in parantheses for casting e.g. ( int )
SpacesInCStyleCastParentheses: 'false'
# Spaces inserted between array brackets
SpacesInContainerLiterals: 'false'
# self-explanatory
SpacesInParentheses: 'false'
# self-explanatory
SpacesInSquareBrackets: 'false'
# self-explanatory
TabWidth: '4'
# self-explanatory
UseTab: Never
# macros which have sensitive whitespace and should be left alone
WhitespaceSensitiveMacros: ['set_value', 'set_scale', 'set_raw']