-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy path.clang-format
More file actions
203 lines (187 loc) · 5.59 KB
/
.clang-format
File metadata and controls
203 lines (187 loc) · 5.59 KB
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
# Documentation: https://clang.llvm.org/docs/ClangFormatStyleOptions.html
---
Language: Cpp
Standard: c++17
#BasedOnStyle: Mozilla
# max line length
ColumnLimit: 128
LineEnding: LF
InsertNewlineAtEOF: true
IndentWidth: 3
ContinuationIndentWidth: 3
IndentAccessModifiers: false
AccessModifierOffset: -3
IndentCaseLabels: true
IndentCaseBlocks: true
IndentGotoLabels: false
IndentPPDirectives: BeforeHash
IndentExternBlock: NoIndent
IndentWrappedFunctionNames: false
NamespaceIndentation: None
FixNamespaceComments: true
CompactNamespaces: false
ShortNamespaceLines: 10
EmptyLineAfterAccessModifier: Never
EmptyLineBeforeAccessModifier: LogicalBlock
KeepEmptyLinesAtTheStartOfBlocks: false
MaxEmptyLinesToKeep: 1
SeparateDefinitionBlocks: Leave # 'Always' breaks formatting of __cuda_callable__ etc.
SpacesInParens: Custom
SpacesInParensOptions:
ExceptDoubleParentheses: false
InConditionalStatements: true
InCStyleCasts: false
InEmptyParentheses: false
Other: true
SpacesInSquareBrackets: true
SpacesInAngles: Always
SpacesInContainerLiterals: true
SpaceAfterCStyleCast: true
SpaceAfterLogicalNot: true
SpaceAfterTemplateKeyword: false
SpaceBeforeCtorInitializerColon: true
SpaceBeforeInheritanceColon: true
BitFieldColonSpacing: Both
SpaceBeforeParens: Never
SpaceBeforeRangeBasedForLoopColon: true
SpaceBeforeSquareBrackets: false
SpaceBeforeAssignmentOperators: true
SpaceBeforeCaseColon: false
SpaceBeforeCpp11BracedList: false
SpaceInEmptyBlock: false
SpacesInLineCommentPrefix:
Minimum: 0
SpacesBeforeTrailingComments: 2
Cpp11BracedListStyle: false
PackConstructorInitializers: Never
ConstructorInitializerIndentWidth: 0
BreakAfterAttributes: Never
BreakAfterOpenBracketBracedList: true
BreakAfterOpenBracketFunction: true
BreakAfterOpenBracketIf: false
BreakAfterOpenBracketLoop: false
BreakAfterReturnType: All
AlwaysBreakBeforeMultilineStrings: true
BreakBeforeBraces: Custom
BraceWrapping:
AfterCaseLabel: false
AfterClass: true
AfterControlStatement: MultiLine
AfterEnum: true
AfterFunction: true
AfterNamespace: false
AfterStruct: true
AfterUnion: true
AfterExternBlock: true
BeforeLambdaBody: true
BeforeCatch: true
BeforeElse: true
BeforeWhile: false
IndentBraces: false
SplitEmptyFunction: false
SplitEmptyRecord: false
SplitEmptyNamespace: true
BreakBeforeBinaryOperators: NonAssignment
BreakBeforeTernaryOperators: true
BreakInheritanceList: BeforeColon
BreakConstructorInitializers: BeforeColon
BreakTemplateDeclarations: Yes
BreakBeforeConceptDeclarations: Always
AlignAfterOpenBracket: Align
AlignArrayOfStructures: None
AlignConsecutiveMacros: None
AlignConsecutiveAssignments: None
AlignConsecutiveBitFields: None
AlignConsecutiveDeclarations: None
AlignEscapedNewlines: Left
AlignOperands: AlignAfterOperator
AlignTrailingComments:
Kind: Always
OverEmptyLines: 0
DerivePointerAlignment: false
PointerAlignment: Left
ReferenceAlignment: Pointer
# this is needed so that clang-format does not treat these macros as function calls and formats the arguments accordingly
# (notably, it must not remove parentheses in ASSERT_TRUE((foo<x,y>(0,1))) etc. because then the comma would become
# a separator of the macro arguments rather than template arguments)
Macros:
- ASSERT_THAT(x)=abc<<x
- ASSERT_TRUE(x)=abc<<x
- ASSERT_FALSE(x)=abc<<x
- ASSERT_EQ(x,y)=abc<<(x==y)
- ASSERT_NE(x,y)=abc<<(x!=y)
- ASSERT_LT(x,y)=abc<<(x<y)
- ASSERT_LE(x,y)=abc<<(x<=y)
- ASSERT_GT(x,y)=abc<<(x>y)
- ASSERT_GE(x,y)=abc<<(x>=y)
- EXPECT_THAT(x)=abc<<x
- EXPECT_TRUE(x)=abc<<x
- EXPECT_FALSE(x)=abc<<x
- EXPECT_EQ(x,y)=abc<<(x==y)
- EXPECT_NE(x,y)=abc<<(x!=y)
- EXPECT_LT(x,y)=abc<<(x<y)
- EXPECT_LE(x,y)=abc<<(x<=y)
- EXPECT_GT(x,y)=abc<<(x>y)
- EXPECT_GE(x,y)=abc<<(x>=y)
# statement macros are typically formatted on their own lines
StatementMacros:
- __global__
- __host__
- __device__
- __cuda_callable__
# Note: forcing qualifier alignment does not work with __cuda_callable__ etc. (no way to force them to the left)
#QualifierAlignment: Custom
#QualifierOrder:
# - static
# - inline
# - constexpr
# - const
# - type
AllowAllArgumentsOnNextLine: true
AllowAllParametersOfDeclarationOnNextLine: false
AllowShortEnumsOnASingleLine: true
AllowShortBlocksOnASingleLine: Never
AllowShortCaseLabelsOnASingleLine: false
AllowShortFunctionsOnASingleLine: Empty
AllowShortLambdasOnASingleLine: Empty
AllowShortIfStatementsOnASingleLine: Never
AllowShortLoopsOnASingleLine: false
BinPackArguments: false
BinPackParameters: false
#CommentPragmas: '^ IWYU pragma:'
#IncludeBlocks: Preserve
#IncludeCategories:
# - Regex: '^"(llvm|llvm-c|clang|clang-c)/'
# Priority: 2
# SortPriority: 0
# CaseSensitive: false
# - Regex: '^(<|"(gtest|gmock|isl|json)/)'
# Priority: 3
# SortPriority: 0
# CaseSensitive: false
# - Regex: '.*'
# Priority: 1
# SortPriority: 0
# CaseSensitive: false
#IncludeIsMainRegex: '(Test)?$'
#IncludeIsMainSourceRegex: ''
#PenaltyBreakAssignment: 2
#PenaltyBreakBeforeFirstCallParameter: 19
#PenaltyBreakComment: 300
#PenaltyBreakFirstLessLess: 120
#PenaltyBreakString: 1000
#PenaltyBreakTemplateDeclaration: 10
PenaltyExcessCharacter: 500
#PenaltyIndentedWhitespace: 0
#PPIndentWidth: -1
#SortIncludes: CaseSensitive
#SortUsingDeclarations: true
# FIXME: sorting includes causes a lot of breakage due to cyclic inclusion problems
SortIncludes: Never
# NOTE: disabling this option breaks indentation of comments, see https://github.com/llvm/llvm-project/issues/53425
ReflowComments: true
InsertTrailingCommas: Wrapped
RemoveParentheses: ReturnStatement
RemoveSemicolon: true
...
# vim: ft=yaml