1bf215546Sopenharmony_ci# Copyright © 2022 Imagination Technologies Ltd.
2bf215546Sopenharmony_ci
3bf215546Sopenharmony_ci# Permission is hereby granted, free of charge, to any person obtaining a copy
4bf215546Sopenharmony_ci# of this software and associated documentation files (the "Software"), to deal
5bf215546Sopenharmony_ci# in the Software without restriction, including without limitation the rights
6bf215546Sopenharmony_ci# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
7bf215546Sopenharmony_ci# copies of the Software, and to permit persons to whom the Software is
8bf215546Sopenharmony_ci# furnished to do so, subject to the following conditions:
9bf215546Sopenharmony_ci
10bf215546Sopenharmony_ci# The above copyright notice and this permission notice (including the next
11bf215546Sopenharmony_ci# paragraph) shall be included in all copies or substantial portions of the
12bf215546Sopenharmony_ci# Software.
13bf215546Sopenharmony_ci
14bf215546Sopenharmony_ci# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15bf215546Sopenharmony_ci# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16bf215546Sopenharmony_ci# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
17bf215546Sopenharmony_ci# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
18bf215546Sopenharmony_ci# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
19bf215546Sopenharmony_ci# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
20bf215546Sopenharmony_ci# SOFTWARE.
21bf215546Sopenharmony_ci
22bf215546Sopenharmony_ciLanguage: Cpp
23bf215546Sopenharmony_ciStandard: c++11
24bf215546Sopenharmony_ci
25bf215546Sopenharmony_ciUseCRLF: false
26bf215546Sopenharmony_ciColumnLimit: 80
27bf215546Sopenharmony_ci
28bf215546Sopenharmony_ciDeriveLineEnding: false
29bf215546Sopenharmony_ciDerivePointerAlignment: false
30bf215546Sopenharmony_ciExperimentalAutoDetectBinPacking: false
31bf215546Sopenharmony_ci
32bf215546Sopenharmony_ciDisableFormat: false
33bf215546Sopenharmony_ci
34bf215546Sopenharmony_ci########
35bf215546Sopenharmony_ci# Tabs #
36bf215546Sopenharmony_ci########
37bf215546Sopenharmony_ciUseTab: Never
38bf215546Sopenharmony_ciTabWidth: 3
39bf215546Sopenharmony_ci
40bf215546Sopenharmony_ciConstructorInitializerIndentWidth: 6
41bf215546Sopenharmony_ciContinuationIndentWidth: 3
42bf215546Sopenharmony_ci
43bf215546Sopenharmony_ciIndentWidth: 3
44bf215546Sopenharmony_ci#IndentCaseBlocks: true  # Requires clang-11
45bf215546Sopenharmony_ciIndentCaseLabels: false
46bf215546Sopenharmony_ci#IndentExternBlock: NoIndent  # Requires clang-11
47bf215546Sopenharmony_ciIndentGotoLabels: false
48bf215546Sopenharmony_ciIndentPPDirectives: AfterHash
49bf215546Sopenharmony_ciIndentWrappedFunctionNames: false
50bf215546Sopenharmony_ciAccessModifierOffset: -4  # -IndentWidth
51bf215546Sopenharmony_ci
52bf215546Sopenharmony_ciNamespaceIndentation: None
53bf215546Sopenharmony_ci
54bf215546Sopenharmony_ci##########
55bf215546Sopenharmony_ci# Braces #
56bf215546Sopenharmony_ci##########
57bf215546Sopenharmony_ciAlignAfterOpenBracket: Align
58bf215546Sopenharmony_ciAllowAllArgumentsOnNextLine: false
59bf215546Sopenharmony_ciAllowAllConstructorInitializersOnNextLine: false
60bf215546Sopenharmony_ciAllowAllParametersOfDeclarationOnNextLine: false
61bf215546Sopenharmony_ciBinPackArguments: false
62bf215546Sopenharmony_ciBinPackParameters: false
63bf215546Sopenharmony_ci
64bf215546Sopenharmony_ciCpp11BracedListStyle: false
65bf215546Sopenharmony_ci
66bf215546Sopenharmony_ci########################
67bf215546Sopenharmony_ci# Whitespace Alignment #
68bf215546Sopenharmony_ci########################
69bf215546Sopenharmony_ciAlignConsecutiveAssignments: false
70bf215546Sopenharmony_ci#AlignConsecutiveBitFields: false  # Requires clang-11
71bf215546Sopenharmony_ciAlignConsecutiveDeclarations: false
72bf215546Sopenharmony_ciAlignConsecutiveMacros: false
73bf215546Sopenharmony_ciAlignTrailingComments: false
74bf215546Sopenharmony_ci
75bf215546Sopenharmony_ciAlignEscapedNewlines: Left
76bf215546Sopenharmony_ci
77bf215546Sopenharmony_ci#AlignOperands: Align  # Requires clang-11
78bf215546Sopenharmony_ci#BitFieldColonSpacing: Both  # Requires clang-12
79bf215546Sopenharmony_ci
80bf215546Sopenharmony_ciPointerAlignment: Right
81bf215546Sopenharmony_ci#SpaceAroundPointerQualifiers: Both  # Requires clang-12
82bf215546Sopenharmony_ci
83bf215546Sopenharmony_ciSpaceAfterCStyleCast: false
84bf215546Sopenharmony_ciSpaceAfterLogicalNot: false
85bf215546Sopenharmony_ciSpaceAfterTemplateKeyword: true
86bf215546Sopenharmony_ciSpaceBeforeAssignmentOperators: true
87bf215546Sopenharmony_ciSpaceBeforeCpp11BracedList: false
88bf215546Sopenharmony_ciSpaceBeforeCtorInitializerColon: true
89bf215546Sopenharmony_ciSpaceBeforeInheritanceColon: true
90bf215546Sopenharmony_ciSpaceBeforeParens: ControlStatements
91bf215546Sopenharmony_ci#SpaceBeforeParens: ControlStatementsExceptForEachMacros  # Requires clang-11
92bf215546Sopenharmony_ciSpaceBeforeRangeBasedForLoopColon: true
93bf215546Sopenharmony_ciSpaceBeforeSquareBrackets: false
94bf215546Sopenharmony_ciSpaceInEmptyBlock: false
95bf215546Sopenharmony_ciSpaceInEmptyParentheses: false
96bf215546Sopenharmony_ciSpacesInAngles: false
97bf215546Sopenharmony_ciSpacesInCStyleCastParentheses: false
98bf215546Sopenharmony_ciSpacesInConditionalStatement: false
99bf215546Sopenharmony_ciSpacesInContainerLiterals: false
100bf215546Sopenharmony_ciSpacesInParentheses: false
101bf215546Sopenharmony_ciSpacesInSquareBrackets: false
102bf215546Sopenharmony_ciSpacesBeforeTrailingComments: 2
103bf215546Sopenharmony_ci
104bf215546Sopenharmony_ci############################
105bf215546Sopenharmony_ci# Multi-line constructions #
106bf215546Sopenharmony_ci############################
107bf215546Sopenharmony_ciAllowShortBlocksOnASingleLine: Empty
108bf215546Sopenharmony_ciAllowShortCaseLabelsOnASingleLine: false
109bf215546Sopenharmony_ci#AllowShortEnumsOnASingleLine: false  # Requires clang-11
110bf215546Sopenharmony_ciAllowShortFunctionsOnASingleLine: Empty
111bf215546Sopenharmony_ciAllowShortIfStatementsOnASingleLine: Never
112bf215546Sopenharmony_ciAllowShortLambdasOnASingleLine: All
113bf215546Sopenharmony_ciAllowShortLoopsOnASingleLine: false
114bf215546Sopenharmony_ci
115bf215546Sopenharmony_ciAlwaysBreakAfterReturnType: None
116bf215546Sopenharmony_ciAlwaysBreakBeforeMultilineStrings: false
117bf215546Sopenharmony_ciAlwaysBreakTemplateDeclarations: Yes
118bf215546Sopenharmony_ci
119bf215546Sopenharmony_ciBreakBeforeBraces: Custom
120bf215546Sopenharmony_ciBraceWrapping:
121bf215546Sopenharmony_ci  AfterCaseLabel: false
122bf215546Sopenharmony_ci  AfterClass: false
123bf215546Sopenharmony_ci  AfterControlStatement: Never
124bf215546Sopenharmony_ci  AfterEnum: false
125bf215546Sopenharmony_ci  AfterFunction: true
126bf215546Sopenharmony_ci  AfterNamespace: true
127bf215546Sopenharmony_ci  AfterObjCDeclaration: false
128bf215546Sopenharmony_ci  AfterStruct: false
129bf215546Sopenharmony_ci  AfterUnion: false
130bf215546Sopenharmony_ci  BeforeCatch: false
131bf215546Sopenharmony_ci  BeforeElse: false
132bf215546Sopenharmony_ci#  BeforeLambdaBody: false  # Requires clang-11
133bf215546Sopenharmony_ci  IndentBraces: false
134bf215546Sopenharmony_ci  SplitEmptyFunction: true
135bf215546Sopenharmony_ci  SplitEmptyNamespace: true
136bf215546Sopenharmony_ci  SplitEmptyRecord: true
137bf215546Sopenharmony_ci
138bf215546Sopenharmony_ciBreakBeforeBinaryOperators: None
139bf215546Sopenharmony_ciBreakBeforeTernaryOperators: true
140bf215546Sopenharmony_ci
141bf215546Sopenharmony_ciBreakConstructorInitializers: AfterColon
142bf215546Sopenharmony_ciBreakInheritanceList: AfterColon
143bf215546Sopenharmony_ci
144bf215546Sopenharmony_ciBreakStringLiterals: false
145bf215546Sopenharmony_ci
146bf215546Sopenharmony_ciCompactNamespaces: false
147bf215546Sopenharmony_ciConstructorInitializerAllOnOneLineOrOnePerLine: true
148bf215546Sopenharmony_ci
149bf215546Sopenharmony_ci#InsertTrailingCommas: Wrapped  # Requires clang-11
150bf215546Sopenharmony_ci
151bf215546Sopenharmony_ciKeepEmptyLinesAtTheStartOfBlocks: false
152bf215546Sopenharmony_ciMaxEmptyLinesToKeep: 1
153bf215546Sopenharmony_ci
154bf215546Sopenharmony_ciSortUsingDeclarations: true
155bf215546Sopenharmony_ci
156bf215546Sopenharmony_ci############
157bf215546Sopenharmony_ci# Includes #
158bf215546Sopenharmony_ci############
159bf215546Sopenharmony_ci# TODO: Temporary config
160bf215546Sopenharmony_ciIncludeBlocks: Preserve
161bf215546Sopenharmony_ciSortIncludes: false
162bf215546Sopenharmony_ci# TODO: This requires additional work to clean up headers & includes first
163bf215546Sopenharmony_ci#IncludeBlocks: Regroup
164bf215546Sopenharmony_ci#SortIncludes: true
165bf215546Sopenharmony_ci#IncludeIsMainRegex: '(_test)?$'
166bf215546Sopenharmony_ci##IncludeIsMainSourceRegex: <default>
167bf215546Sopenharmony_ci#IncludeCategories:
168bf215546Sopenharmony_ci#  - Regex:        '^"'
169bf215546Sopenharmony_ci#    Priority:     1
170bf215546Sopenharmony_ci
171bf215546Sopenharmony_ci############
172bf215546Sopenharmony_ci# Comments #
173bf215546Sopenharmony_ci############
174bf215546Sopenharmony_ciFixNamespaceComments: false
175bf215546Sopenharmony_ci
176bf215546Sopenharmony_ci#############
177bf215546Sopenharmony_ci# Penalties #
178bf215546Sopenharmony_ci#############
179bf215546Sopenharmony_ci# Taken from torvalds/kernel:.clang-format
180bf215546Sopenharmony_ciPenaltyBreakAssignment: 10
181bf215546Sopenharmony_ciPenaltyBreakBeforeFirstCallParameter: 30
182bf215546Sopenharmony_ciPenaltyBreakComment: 10
183bf215546Sopenharmony_ciPenaltyBreakFirstLessLess: 0
184bf215546Sopenharmony_ciPenaltyBreakString: 10
185bf215546Sopenharmony_ciPenaltyBreakTemplateDeclaration: 10
186bf215546Sopenharmony_ciPenaltyExcessCharacter: 100
187bf215546Sopenharmony_ciPenaltyReturnTypeOnItsOwnLine: 60
188bf215546Sopenharmony_ci
189bf215546Sopenharmony_ci#######################
190bf215546Sopenharmony_ci# User-defined macros #
191bf215546Sopenharmony_ci#######################
192bf215546Sopenharmony_ciCommentPragmas: '^ IWYU pragma:'
193bf215546Sopenharmony_ci
194bf215546Sopenharmony_ciMacroBlockBegin: ''
195bf215546Sopenharmony_ciMacroBlockEnd: ''
196bf215546Sopenharmony_ci
197bf215546Sopenharmony_ci#AttributeMacros: []  # Requires clang-12
198bf215546Sopenharmony_ci
199bf215546Sopenharmony_ciForEachMacros: [
200bf215546Sopenharmony_ci  'foreach_instr',
201bf215546Sopenharmony_ci  'foreach_instr_safe',
202bf215546Sopenharmony_ci  'hash_table_foreach',
203bf215546Sopenharmony_ci  'LIST_FOR_EACH_ENTRY',
204bf215546Sopenharmony_ci  'LIST_FOR_EACH_ENTRY_FROM',
205bf215546Sopenharmony_ci  'LIST_FOR_EACH_ENTRY_FROM_REV',
206bf215546Sopenharmony_ci  'LIST_FOR_EACH_ENTRY_SAFE',
207bf215546Sopenharmony_ci  'LIST_FOR_EACH_ENTRY_SAFE_REV',
208bf215546Sopenharmony_ci  'list_for_each_entry',
209bf215546Sopenharmony_ci  'list_for_each_entry_from',
210bf215546Sopenharmony_ci  'list_for_each_entry_from_rev',
211bf215546Sopenharmony_ci  'list_for_each_entry_from_safe',
212bf215546Sopenharmony_ci  'list_for_each_entry_rev',
213bf215546Sopenharmony_ci  'list_for_each_entry_safe',
214bf215546Sopenharmony_ci  'list_for_each_entry_safe_rev',
215bf215546Sopenharmony_ci  'list_pair_for_each_entry',
216bf215546Sopenharmony_ci  'pvr_csb_emit',
217bf215546Sopenharmony_ci  'pvr_csb_emit_merge',
218bf215546Sopenharmony_ci  'pvr_csb_pack',
219bf215546Sopenharmony_ci  'nir_foreach_block',
220bf215546Sopenharmony_ci  'nir_foreach_block_safe',
221bf215546Sopenharmony_ci  'nir_foreach_function',
222bf215546Sopenharmony_ci  'nir_foreach_instr',
223bf215546Sopenharmony_ci  'nir_foreach_instr_safe',
224bf215546Sopenharmony_ci  'nir_foreach_shader_in_variable',
225bf215546Sopenharmony_ci  'nir_foreach_shader_out_variable',
226bf215546Sopenharmony_ci  'nir_foreach_use',
227bf215546Sopenharmony_ci  'nir_foreach_use_safe',
228bf215546Sopenharmony_ci  'nir_foreach_variable_with_modes',
229bf215546Sopenharmony_ci  'u_vector_foreach',
230bf215546Sopenharmony_ci  'util_dynarray_foreach',
231bf215546Sopenharmony_ci  'vk_foreach_struct',
232bf215546Sopenharmony_ci  'vk_foreach_struct_const',
233bf215546Sopenharmony_ci# FIXME: vk_outarray_append doesn't fit here, remove
234bf215546Sopenharmony_ci# it when a better solution exists for it.
235bf215546Sopenharmony_ci  'vk_outarray_append',
236bf215546Sopenharmony_ci  'vk_outarray_append_typed'
237bf215546Sopenharmony_ci]
238bf215546Sopenharmony_ci
239bf215546Sopenharmony_ciNamespaceMacros: [
240bf215546Sopenharmony_ci]
241bf215546Sopenharmony_ci
242bf215546Sopenharmony_ciStatementMacros: [
243bf215546Sopenharmony_ci]
244bf215546Sopenharmony_ci
245bf215546Sopenharmony_ciTypenameMacros: [
246bf215546Sopenharmony_ci]
247bf215546Sopenharmony_ci
248bf215546Sopenharmony_ci#WhitespaceSensitiveMacros: []  # Requires clang-11
249