-
Notifications
You must be signed in to change notification settings - Fork 0
/
.clang-format
277 lines (277 loc) · 11.3 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
###############################################################################
# SPDX-License-Identifier: CC0-1.0
# SPDX-FileType: OTHER
# SPDX-FileCopyrightText: (c) 2022, OpenGateware authors and contributors
###############################################################################
---
Language: Cpp
Standard: c++17
BasedOnStyle: LLVM
# The extra indent or outdent of access modifiers (e.g., public)
AccessModifierOffset: -4
# Align parameters on the open bracket
# someLongFunction(argument1,
# argument2);
AlignAfterOpenBracket: Align
# Do not align equals signs of consecutive assignments
AlignConsecutiveAssignments: None
# Do not align the value of consecutive macros
AlignConsecutiveMacros: Consecutive
# Do not align the colons of consecutive bitfields
AlignConsecutiveBitFields: Consecutive
# Do not align the variable names of consecutive declarations
AlignConsecutiveDeclarations: None
# Align escaped newlines in macros - as far left as possible
AlignEscapedNewlines: Right
# Horizontally align operands of binary and ternary expressions
# Keeping the operand on the right edge of the upper line
AlignOperands: Align
# Do not align consecutive comments that follow a line of code
AlignTrailingComments: true
# If a function call or braced initializer list doesn't fit on a line,
# allow putting all arguments onto the next line, even if BinPackArguments is false.
AllowAllArgumentsOnNextLine: true
# If a constructor definition with a member initializer list doesn't fit on a
# single line, allow putting all member initializers onto the next line, if
# `ConstructorInitializerAllOnOneLineOrOnePerLine` is true. Note that this parameter
# has no effect if `ConstructorInitializerAllOnOneLineOrOnePerLine` is false.
AllowAllConstructorInitializersOnNextLine: 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.
AllowAllParametersOfDeclarationOnNextLine: true
AllowShortEnumsOnASingleLine: false
AllowShortBlocksOnASingleLine: Empty
AllowShortCaseLabelsOnASingleLine: true
AllowShortFunctionsOnASingleLine: None
AllowShortLambdasOnASingleLine: All
AllowShortIfStatementsOnASingleLine: Never
AllowShortLoopsOnASingleLine: false
AlwaysBreakAfterDefinitionReturnType: None
AlwaysBreakAfterReturnType: None
AlwaysBreakBeforeMultilineStrings: false
AlwaysBreakTemplateDeclarations: Yes
BinPackArguments: true
BinPackParameters: true
# Add one space on each side of the :
BitFieldColonSpacing: Both
# Configure each individual brace in BraceWrapping.
BreakBeforeBraces: Custom
BraceWrapping:
# Opening brace under case label
AfterCaseLabel: false
# Class brace opens on the same line as the class name
AfterClass: false
# Braces are under control statement
AfterControlStatement: Never
# Braces are under enum
AfterEnum: false
# Braces are under function prototype
AfterFunction: false
# Braces are under namespace
AfterNamespace: false
# Braces are under struct keyword
AfterStruct: false
# Braces are under union keyword
AfterUnion: false
# Braces are under extern keyword
AfterExternBlock: false
# Braces are under catch keyword
BeforeCatch: false
# else keyword is placed under if close brace
BeforeElse: false
# Braces Wrap lambda block.
BeforeLambdaBody: false
# Do not place a trailing while loop below the close brace
BeforeWhile: false
# Do not indent wrapped braces
IndentBraces: false
# Empty function body braces are on multiple lines
SplitEmptyFunction: false
# Empty class/struct/union body braces are on multiple lines
SplitEmptyRecord: true
# empty namespace body braces are on multiple lines
SplitEmptyNamespace: true
# For splitting long binary operations, break after the operator
BreakBeforeBinaryOperators: None
# Place concept declaration on a new line
BreakBeforeConceptDeclarations: true
# Ternary operators will be placed after line breaks.
BreakBeforeTernaryOperators: true
# Break constructor initializers after the colon and commas
BreakConstructorInitializers: AfterColon
# Break inheritance list after the colon and comma
BreakInheritanceList: AfterColon
# Allow breaking long string literals into multiple lines
BreakStringLiterals: true
# Max Width of a line when formatting
ColumnLimit: 180
# A regular expression that describes comments with special meaning,
# which should not be split into lines or otherwise changed.
CommentPragmas: '^ IWYU pragma:'
# Each namespace declaration is placed on a new line
CompactNamespaces: false
# Do not require initializers to be on their own lines when breaking
ConstructorInitializerAllOnOneLineOrOnePerLine: false
# The number of characters to use for indentation of constructor initializer
# lists as well as inheritance lists.
ConstructorInitializerIndentWidth: 4
# Indent width for line continuations.
ContinuationIndentWidth: 4
# format braced lists as best suited for C++11 braced lists
Cpp11BracedListStyle: true
# Analyze the formatted file for the most used line ending (\r\n or \n).
# UseCRLF is only used as a fallback if none can be derived.
DeriveLineEnding: true
# Do not read the file to derive pointer alignment requirements. Uses PointerAlignment value.
DerivePointerAlignment: false
# Do not completely disable formatting
DisableFormat: false
# Remove all empty lines after access modifiers
#EmptyLineAfterAccessModifier: Never
# Add empty line only when access modifier starts a new logical block.
# Logical block is a group of one or more member fields or functions.
EmptyLineBeforeAccessModifier: LogicalBlock
# Each call can be bin-packed, one-per-line or inconclusive.
ExperimentalAutoDetectBinPacking: false
# add missing namespace end comments for short namespaces and fixes invalid existing ones.
FixNamespaceComments: true
# A vector of macros that should be interpreted as foreach loops instead of as function calls.
ForEachMacros: [ foreach, Q_FOREACH, BOOST_FOREACH ]
# Sort each #include block separately (blocks of includes are separated by empty lines)
IncludeBlocks: Preserve
# Regular expressions denoting the different #include categories used for ordering #includes.
IncludeCategories:
- Regex: '^"(llvm|llvm-c|clang|clang-c)/'
Priority: 2
SortPriority: 0
CaseSensitive: false
- Regex: '^(<|"(gtest|gmock|isl|json|catch2|cmocka)/)'
Priority: 3
SortPriority: 0
CaseSensitive: false
- Regex: '.*'
Priority: 1
SortPriority: 0
CaseSensitive: false
# Specify a regular expression of suffixes that are allowed in the file-to-main-include mapping.
# use this regex of allowed suffixes to the header stem.
# A partial match is done, so that: - "" means "arbitrary suffix" - "$" means "no suffix"
IncludeIsMainRegex: '$'
# Specify a regular expression for files being formatted that are allowed to be considered
# "main" in the file-to-main-include mapping.
IncludeIsMainSourceRegex: ''
# access modifiers are indented (or outdented) relative to the record members,
# respecting the AccessModifierOffset
#IndentAccessModifiers: false
# Do not indent case blocks one level from case label
IndentCaseBlocks: false
# Do indent case labels within a switch block
IndentCaseLabels: true
# Use AfterExternBlock's indenting rule
IndentExternBlock: AfterExternBlock
# Goto labels are indented to proper level
IndentGotoLabels: false
# Indents preprocessor directives before the hash.
IndentPPDirectives: BeforeHash
# Number of columns to use for indentation
IndentWidth: 4
# Indent if a function definition or declaration is wrapped after the type.
IndentWrappedFunctionNames: false
# Insert trailing commas in container literals (arrays and objects) that wrap across multiple lines.
InsertTrailingCommas: None
# Remove empty lines at the start of a block
KeepEmptyLinesAtTheStartOfBlocks: false
# Align lambda body relative to the start of the lambda signature
#LambdaBodyIndentation: Signature
# A regular expression matching macros that start a block.
MacroBlockBegin: ''
# A regular expression matching macros that end a block.
MacroBlockEnd: ''
# Maximum number of consecutive empty lines to keep
MaxEmptyLinesToKeep: 1
# Don't indent namespaces
NamespaceIndentation: All
# A vector of macros which are used to open namespace blocks
#NamespaceMacros: ''
PenaltyBreakAssignment: 2
PenaltyBreakBeforeFirstCallParameter: 19
PenaltyBreakComment: 300
PenaltyBreakFirstLessLess: 120
PenaltyBreakString: 1000
PenaltyBreakTemplateDeclaration: 10
PenaltyExcessCharacter: 1000000
PenaltyReturnTypeOnItsOwnLine: 60
# align pointers: int *ptr
PointerAlignment: Right
# align references like pointers
ReferenceAlignment: Right
# Clang-format will attempt to reflow long comments
ReflowComments: true
# Always have an ending namespace commment
#ShortNamespaceLines: 0
# Include sorting is alphabetical and case-insensitive
SortIncludes: Never #CaseInsensitive
# using declarations will be alphabetically sorted
SortUsingDeclarations: true
# Do not insert a space after a C-style cast
SpaceAfterCStyleCast: false
# Do not insert as pace after a logical not (!)
SpaceAfterLogicalNot: false
# Do not insert as pace after the template keyword
SpaceAfterTemplateKeyword: false
# Don't ensure spaces around pointer qualifiers, use PointerAlignment instead
SpaceAroundPointerQualifiers: Default
# Place spaces before assignment operators (=, +=, etc.)
SpaceBeforeAssignmentOperators: true
# Do not place a space before a case statement colon
SpaceBeforeCaseColon: false
# Do not place a space before a C++11 braced list
SpaceBeforeCpp11BracedList: false
# Do place a space between the constructor and the initializer colon
SpaceBeforeCtorInitializerColon: true
# Place a space between the class and the inheritance colon
SpaceBeforeInheritanceColon: true
# Never place a space between an item and following parens
SpaceBeforeParens: Never
# do not place a space before a range based for loop
SpaceBeforeRangeBasedForLoopColon: false
# do not place a space before square brackets []
SpaceBeforeSquareBrackets: false
# do not place a space in an empty block
SpaceInEmptyBlock: false
# Do not place a space in empty parens
SpaceInEmptyParentheses: false
# Spaces between end of the code and the start of a // line comment
SpacesBeforeTrailingComments: 1
# Remove spaces within <> : <int>
SpacesInAngles: false #Never
# Do not add spaces in C-style cast parens
SpacesInCStyleCastParentheses: false
# Do not add spaces around if/for/while/switch conditions
SpacesInConditionalStatement: false
# Do not insert spaces inside container literals
SpacesInContainerLiterals: false
# Do not insert spaces after ( and before )
SpacesInParentheses: false
# Do not insert spaces after [ and before ]
SpacesInSquareBrackets: false
# Macros which are ignored in front of a statement, as if they were an attribute.
# StatementAttributeLikeMacros:
# A vector of macros that should be interpreted as complete statements.
# StatementMacros: ''
# The number of columns used for tab stops.
TabWidth: 4
# A vector of macros that should be interpreted as type declarations instead of as function calls.
#TypenameMacros: ''
# use \n for line breaks
UseCRLF: false
# Use tabs whenever we need to fill whitespace that spans at least from one tab stop to the next one.
UseTab: ForContinuationAndIndentation
# A vector of macros which are whitespace-sensitive and should not be touched.
WhitespaceSensitiveMacros:
- STRINGIZE
- PP_STRINGIZE
- BOOST_PP_STRINGIZE
- NS_SWIFT_NAME
- CF_SWIFT_NAME
...