# Copyright © 2022 Imagination Technologies Ltd. # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to deal # in the Software without restriction, including without limitation the rights # to use, copy, modify, merge, publish, distribute, sublicense, and/or sell # copies of the Software, and to permit persons to whom the Software is # furnished to do so, subject to the following conditions: # The above copyright notice and this permission notice (including the next # paragraph) shall be included in all copies or substantial portions of the # Software. # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE # AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER # LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE # SOFTWARE. Language: Cpp Standard: c++11 UseCRLF: false ColumnLimit: 80 DeriveLineEnding: false DerivePointerAlignment: false ExperimentalAutoDetectBinPacking: false DisableFormat: false ######## # Tabs # ######## UseTab: Never TabWidth: 3 ConstructorInitializerIndentWidth: 6 ContinuationIndentWidth: 3 IndentWidth: 3 #IndentCaseBlocks: true # Requires clang-11 IndentCaseLabels: false #IndentExternBlock: NoIndent # Requires clang-11 IndentGotoLabels: false IndentPPDirectives: AfterHash IndentWrappedFunctionNames: false AccessModifierOffset: -4 # -IndentWidth NamespaceIndentation: None ########## # Braces # ########## AlignAfterOpenBracket: Align AllowAllArgumentsOnNextLine: false AllowAllConstructorInitializersOnNextLine: false AllowAllParametersOfDeclarationOnNextLine: false BinPackArguments: false BinPackParameters: false Cpp11BracedListStyle: false ######################## # Whitespace Alignment # ######################## AlignConsecutiveAssignments: false #AlignConsecutiveBitFields: false # Requires clang-11 AlignConsecutiveDeclarations: false AlignConsecutiveMacros: false AlignTrailingComments: false AlignEscapedNewlines: Left #AlignOperands: Align # Requires clang-11 #BitFieldColonSpacing: Both # Requires clang-12 PointerAlignment: Right #SpaceAroundPointerQualifiers: Both # Requires clang-12 SpaceAfterCStyleCast: false SpaceAfterLogicalNot: false SpaceAfterTemplateKeyword: true SpaceBeforeAssignmentOperators: true SpaceBeforeCpp11BracedList: false SpaceBeforeCtorInitializerColon: true SpaceBeforeInheritanceColon: true SpaceBeforeParens: ControlStatements #SpaceBeforeParens: ControlStatementsExceptForEachMacros # Requires clang-11 SpaceBeforeRangeBasedForLoopColon: true SpaceBeforeSquareBrackets: false SpaceInEmptyBlock: false SpaceInEmptyParentheses: false SpacesInAngles: false SpacesInCStyleCastParentheses: false SpacesInConditionalStatement: false SpacesInContainerLiterals: false SpacesInParentheses: false SpacesInSquareBrackets: false SpacesBeforeTrailingComments: 2 ############################ # Multi-line constructions # ############################ AllowShortBlocksOnASingleLine: Empty AllowShortCaseLabelsOnASingleLine: false #AllowShortEnumsOnASingleLine: false # Requires clang-11 AllowShortFunctionsOnASingleLine: Empty AllowShortIfStatementsOnASingleLine: Never AllowShortLambdasOnASingleLine: All AllowShortLoopsOnASingleLine: false AlwaysBreakAfterReturnType: None AlwaysBreakBeforeMultilineStrings: false AlwaysBreakTemplateDeclarations: Yes BreakBeforeBraces: Custom BraceWrapping: AfterCaseLabel: false AfterClass: false AfterControlStatement: Never AfterEnum: false AfterFunction: true AfterNamespace: true AfterObjCDeclaration: false AfterStruct: false AfterUnion: false BeforeCatch: false BeforeElse: false # BeforeLambdaBody: false # Requires clang-11 IndentBraces: false SplitEmptyFunction: true SplitEmptyNamespace: true SplitEmptyRecord: true BreakBeforeBinaryOperators: None BreakBeforeTernaryOperators: true BreakConstructorInitializers: AfterColon BreakInheritanceList: AfterColon BreakStringLiterals: false CompactNamespaces: false ConstructorInitializerAllOnOneLineOrOnePerLine: true #InsertTrailingCommas: Wrapped # Requires clang-11 KeepEmptyLinesAtTheStartOfBlocks: false MaxEmptyLinesToKeep: 1 SortUsingDeclarations: true ############ # Includes # ############ # TODO: Temporary config IncludeBlocks: Preserve SortIncludes: false # TODO: This requires additional work to clean up headers & includes first #IncludeBlocks: Regroup #SortIncludes: true #IncludeIsMainRegex: '(_test)?$' ##IncludeIsMainSourceRegex: #IncludeCategories: # - Regex: '^"' # Priority: 1 ############ # Comments # ############ FixNamespaceComments: false ############# # Penalties # ############# # Taken from torvalds/kernel:.clang-format PenaltyBreakAssignment: 10 PenaltyBreakBeforeFirstCallParameter: 30 PenaltyBreakComment: 10 PenaltyBreakFirstLessLess: 0 PenaltyBreakString: 10 PenaltyBreakTemplateDeclaration: 10 PenaltyExcessCharacter: 100 PenaltyReturnTypeOnItsOwnLine: 60 ####################### # User-defined macros # ####################### CommentPragmas: '^ IWYU pragma:' MacroBlockBegin: '' MacroBlockEnd: '' #AttributeMacros: [] # Requires clang-12 ForEachMacros: [ 'foreach_instr', 'foreach_instr_safe', 'hash_table_foreach', 'LIST_FOR_EACH_ENTRY', 'LIST_FOR_EACH_ENTRY_FROM', 'LIST_FOR_EACH_ENTRY_FROM_REV', 'LIST_FOR_EACH_ENTRY_SAFE', 'LIST_FOR_EACH_ENTRY_SAFE_REV', 'list_for_each_entry', 'list_for_each_entry_from', 'list_for_each_entry_from_rev', 'list_for_each_entry_from_safe', 'list_for_each_entry_rev', 'list_for_each_entry_safe', 'list_for_each_entry_safe_rev', 'list_pair_for_each_entry', 'pvr_csb_emit', 'pvr_csb_emit_merge', 'pvr_csb_pack', 'nir_foreach_block', 'nir_foreach_block_safe', 'nir_foreach_function', 'nir_foreach_instr', 'nir_foreach_instr_safe', 'nir_foreach_shader_in_variable', 'nir_foreach_shader_out_variable', 'nir_foreach_use', 'nir_foreach_use_safe', 'nir_foreach_variable_with_modes', 'u_vector_foreach', 'util_dynarray_foreach', 'vk_foreach_struct', 'vk_foreach_struct_const', # FIXME: vk_outarray_append doesn't fit here, remove # it when a better solution exists for it. 'vk_outarray_append', 'vk_outarray_append_typed' ] NamespaceMacros: [ ] StatementMacros: [ ] TypenameMacros: [ ] #WhitespaceSensitiveMacros: [] # Requires clang-11